Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com>
---
 frontend/afe/rpc_interface.py |   11 ++++++++++-
 server/frontend.py            |    9 ++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 109e5af..3a302dc 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -29,7 +29,7 @@ See doctests/001_rpc_test.txt for (lots) more examples.
 
 __author__ = 'show...@google.com (Steve Howard)'
 
-import datetime
+import datetime, xmlrpclib
 try:
     import autotest.common as common
 except ImportError:
@@ -38,6 +38,7 @@ from autotest_lib.frontend.afe import models, model_logic, 
model_attributes
 from autotest_lib.frontend.afe import control_file, rpc_utils
 from autotest_lib.client.common_lib import global_config
 
+GLOBAL_CONFIG = global_config.global_config
 
 # labels
 
@@ -192,6 +193,10 @@ def get_hosts(multiple_labels=(), 
exclude_only_if_needed_labels=False,
                                                'acl_list')
     models.Host.objects.populate_relationships(hosts, models.HostAttribute,
                                                'attribute_list')
+    xmlrpc_url = GLOBAL_CONFIG.get_config_value('INSTALL_SERVER', 'xmlrpc_url')
+    if xmlrpc_url:
+        server = xmlrpclib.ServerProxy(xmlrpc_url)
+
     host_dicts = []
     for host_obj in hosts:
         host_dict = host_obj.get_object_dict()
@@ -201,6 +206,10 @@ def get_hosts(multiple_labels=(), 
exclude_only_if_needed_labels=False,
         host_dict['acls'] = [acl.name for acl in host_obj.acl_list]
         host_dict['attributes'] = dict((attribute.attribute, attribute.value)
                                        for attribute in 
host_obj.attribute_list)
+        if xmlrpc_url:
+            for label in host_obj.label_list:
+                host_dict['profiles'] = server.find_profile({"comment":"*" + 
label.name + "*"})
+            host_dict['current_profile'] = 
server.find_system({"name":host_dict['hostname']},True)[0]['profile']
         host_dicts.append(host_dict)
     return rpc_utils.prepare_for_serialization(host_dicts)
 
diff --git a/server/frontend.py b/server/frontend.py
index 750f998..fb6a3e4 100644
--- a/server/frontend.py
+++ b/server/frontend.py
@@ -14,7 +14,7 @@ For docs, see:
     http://docs.djangoproject.com/en/dev/ref/models/querysets/#queryset-api
 """
 
-import getpass, os, time, traceback, re
+import getpass, os, time, traceback, re, xmlrpclib
 try:
     import autotest.common as common
 except ImportError:
@@ -175,6 +175,13 @@ class AFE(RpcClient):
                                                     status=status,
                                                     label=label))
         hosts = self.run('get_hosts', **query_args)
+        xmlrpc_url = GLOBAL_CONFIG.get_config_value('INSTALL_SERVER', 
'xmlrpc_url')
+        if xmlrpc_url:
+            server = xmlrpclib.ServerProxy(xmlrpc_url)
+            for host in hosts:
+                for label in host['labels']:
+                    host['profiles'] = server.find_profile({"comment":"*" + 
label + "*"})
+                host['current_profile'] = 
server.find_system({"name":host['hostname']},True)[0]['profile']
         return [Host(self, h) for h in hosts]
 
 
-- 
1.7.7.6


-- 
Nishanth Aravamudan <n...@us.ibm.com>
IBM Linux Technology Center

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to