Add gnt-cluster commands to toggle the master IP
[ganeti-local] / lib / client / gnt_group.py
index 74a6d39..096bb99 100644 (file)
@@ -20,7 +20,7 @@
 
 """Node group related commands"""
 
-# pylint: disable-msg=W0401,W0614
+# pylint: disable=W0401,W0614
 # W0401: Wildcard import ganeti.cli
 # W0614: Unused import %s from wildcard import (since we need cli)
 
@@ -130,17 +130,13 @@ def SetGroupParams(opts, args):
   @return: the desired exit code
 
   """
-  all_changes = {
-    "ndparams": opts.ndparams,
-    "alloc_policy": opts.alloc_policy,
-  }
-
-  if all_changes.values().count(None) == len(all_changes):
+  if opts.ndparams is None and opts.alloc_policy is None:
     ToStderr("Please give at least one of the parameters.")
     return 1
 
-  op = opcodes.OpGroupSetParams(group_name=args[0], # pylint: disable-msg=W0142
-                                **all_changes)
+  op = opcodes.OpGroupSetParams(group_name=args[0],
+                                ndparams=opts.ndparams,
+                                alloc_policy=opts.alloc_policy)
   result = SubmitOrSend(op, opts)
 
   if result:
@@ -212,6 +208,7 @@ def EvacuateGroup(opts, args):
 
   return rcode
 
+
 commands = {
   "add": (
     AddGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT],
@@ -243,7 +240,8 @@ commands = {
   "evacuate": (
     EvacuateGroup, [ArgGroup(min=1, max=1)],
     [TO_GROUP_OPT, IALLOCATOR_OPT, EARLY_RELEASE_OPT],
-    "-I <iallocator> [--to <group>]", "Evacuate all instances within a group"),
+    "[-I <iallocator>] [--to <group>]",
+    "Evacuate all instances within a group"),
   "list-tags": (
     ListTags, ARGS_ONE_GROUP, [PRIORITY_OPT],
     "<instance_name>", "List the tags of the given instance"),