Commit 6bc3ed14 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

gnt-* {add,list,remove}-tags: Unify options



- Listing tags is a query, so neither “--priority” nor “--submit” make
  sense
- Support both options for adding/removing tags
- Also remove “--submit” from “gnt-node health”; it doesn't work and
  doesn't make sense for listing node health
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent ce445897
......@@ -445,7 +445,7 @@ def AddTags(opts, args):
if not args:
raise errors.OpPrereqError("No tags to be added")
op = opcodes.OpTagsSet(kind=kind, name=name, tags=args)
SubmitOpCode(op, opts=opts)
SubmitOrSend(op, opts)
def RemoveTags(opts, args):
......@@ -462,7 +462,7 @@ def RemoveTags(opts, args):
if not args:
raise errors.OpPrereqError("No tags to be removed")
op = opcodes.OpTagsDel(kind=kind, name=name, tags=args)
SubmitOpCode(op, opts=opts)
SubmitOrSend(op, opts)
def check_unit(option, opt, value): # pylint: disable=W0613
......
......@@ -1344,10 +1344,10 @@ commands = {
"list-tags": (
ListTags, ARGS_NONE, [], "", "List the tags of the cluster"),
"add-tags": (
AddTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT],
AddTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"tag...", "Add tags to the cluster"),
"remove-tags": (
RemoveTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT],
RemoveTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"tag...", "Remove tags from the cluster"),
"search-tags": (
SearchTags, [ArgUnknown(min=1, max=1)], [PRIORITY_OPT], "",
......
......@@ -243,15 +243,15 @@ commands = {
"[-I <iallocator>] [--to <group>]",
"Evacuate all instances within a group"),
"list-tags": (
ListTags, ARGS_ONE_GROUP, [PRIORITY_OPT],
ListTags, ARGS_ONE_GROUP, [],
"<instance_name>", "List the tags of the given instance"),
"add-tags": (
AddTags, [ArgGroup(min=1, max=1), ArgUnknown()],
[TAG_SRC_OPT, PRIORITY_OPT],
[TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"<instance_name> tag...", "Add tags to the given instance"),
"remove-tags": (
RemoveTags, [ArgGroup(min=1, max=1), ArgUnknown()],
[TAG_SRC_OPT, PRIORITY_OPT],
[TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"<instance_name> tag...", "Remove tags from given instance"),
}
......
......@@ -1539,15 +1539,15 @@ commands = {
[TO_GROUP_OPT, IALLOCATOR_OPT, EARLY_RELEASE_OPT],
"[-I <iallocator>] [--to <group>]", "Change group of instance"),
"list-tags": (
ListTags, ARGS_ONE_INSTANCE, [PRIORITY_OPT],
ListTags, ARGS_ONE_INSTANCE, [],
"<instance_name>", "List the tags of the given instance"),
"add-tags": (
AddTags, [ArgInstance(min=1, max=1), ArgUnknown()],
[TAG_SRC_OPT, PRIORITY_OPT],
[TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"<instance_name> tag...", "Add tags to the given instance"),
"remove-tags": (
RemoveTags, [ArgInstance(min=1, max=1), ArgUnknown()],
[TAG_SRC_OPT, PRIORITY_OPT],
[TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"<instance_name> tag...", "Remove tags from given instance"),
}
......
......@@ -948,15 +948,16 @@ commands = {
ListTags, ARGS_ONE_NODE, [],
"<node_name>", "List the tags of the given node"),
"add-tags": (
AddTags, [ArgNode(min=1, max=1), ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT],
AddTags, [ArgNode(min=1, max=1), ArgUnknown()],
[TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"<node_name> tag...", "Add tags to the given node"),
"remove-tags": (
RemoveTags, [ArgNode(min=1, max=1), ArgUnknown()],
[TAG_SRC_OPT, PRIORITY_OPT],
[TAG_SRC_OPT, PRIORITY_OPT, SUBMIT_OPT],
"<node_name> tag...", "Remove tags from the given node"),
"health": (
Health, ARGS_MANY_NODES,
[NOHDR_OPT, SEP_OPT, SUBMIT_OPT, PRIORITY_OPT, OOB_TIMEOUT_OPT],
[NOHDR_OPT, SEP_OPT, PRIORITY_OPT, OOB_TIMEOUT_OPT],
"[<node_name>...]", "List health of node(s) using out-of-band"),
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment