Added 2 RPC interfaces to add multiple hosts to a label.
This will be needed by the new CLI.
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1625 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 6a42e60..bfa2f30 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -46,6 +46,16 @@
models.Label.smart_get(id).delete()
+def label_add_hosts(id, hosts):
+ label = models.Label.smart_get(id)
+ [models.Host.smart_get(host).labels.add(label) for host in hosts]
+
+
+def label_remove_hosts(id, hosts):
+ label = models.Label.smart_get(id)
+ [models.Host.smart_get(host).labels.remove(label) for host in hosts]
+
+
def get_labels(**filter_data):
return rpc_utils.prepare_for_serialization(
models.Label.list_objects(filter_data))