Fixed removing hosts from a cloned job. Hosts can now be removed correctly.
Also cleaned up some code in the RPC interface method for job cloning.

Risk: low
Visibility: medium (bug fix on Create Job tab)

Signed-off-by: James Ren <jamesren@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@1997 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index b063215..bb9e464 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -423,27 +423,19 @@
     host_dicts = []
 
     for host in hosts:
-        host_dict = {}
-        host_dict['hostname'] = host.hostname
-        host_dict['id'] = host.id
-
         # one-time host
         if host.invalid:
+            host_dict = {}
+            host_dict['hostname'] = host.hostname
+            host_dict['id'] = host.id
             host_dict['platform'] = '(one-time host)'
             host_dict['locked_text'] = ''
-
         else:
-            platform = host.platform()
-            if platform:
-                host_dict['platform'] = platform.name
-            else:
-                host_dict['platform'] = None
-            labels = [label.name for label in host.labels.all()]
-            if platform and platform.name in labels:
-                labels.remove(platform.name)
-            host_dict['other_labels'] = ', '.join(labels)
-            host_dict['status'] = host.status
-            host_dict['locked'] = host.locked
+            host_dict = get_hosts(id=host.id)[0]
+            other_labels = host_dict['labels']
+            if host_dict['platform']:
+                other_labels.remove(host_dict['platform'])
+            host_dict['other_labels'] = ', '.join(other_labels)
         host_dicts.append(host_dict)
 
     meta_host_counts = {}