diff --git a/lib/cli.py b/lib/cli.py index c70e437aff588ac371f099590720486b04a5cd78..6a5c083543dd2feda12448750a7399c544cce820 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -360,7 +360,9 @@ def _ExtractTagsObject(opts, args): kind = opts.tag_type if kind == constants.TAG_CLUSTER: retval = kind, kind - elif kind == constants.TAG_NODE or kind == constants.TAG_INSTANCE: + elif kind in (constants.TAG_NODEGROUP, + constants.TAG_NODE, + constants.TAG_INSTANCE): if not args: raise errors.OpPrereqError("no arguments passed to the command") name = args.pop(0) diff --git a/lib/client/gnt_group.py b/lib/client/gnt_group.py index 23d2d38763569e6f17059d4d394e44461b00b27f..082d0bf4f797d66c32d15191b184adbc948d37ca 100644 --- a/lib/client/gnt_group.py +++ b/lib/client/gnt_group.py @@ -209,8 +209,20 @@ commands = { "rename": ( RenameGroup, [ArgGroup(min=2, max=2)], [DRY_RUN_OPT], "[--dry-run] <group-name> <new-name>", "Rename a node group"), -} + "list-tags": ( + ListTags, ARGS_ONE_GROUP, [PRIORITY_OPT], + "<instance_name>", "List the tags of the given instance"), + "add-tags": ( + AddTags, [ArgGroup(min=1, max=1), ArgUnknown()], + [TAG_SRC_OPT, PRIORITY_OPT], + "<instance_name> tag...", "Add tags to the given instance"), + "remove-tags": ( + RemoveTags, [ArgGroup(min=1, max=1), ArgUnknown()], + [TAG_SRC_OPT, PRIORITY_OPT], + "<instance_name> tag...", "Remove tags from given instance"), + } def Main(): - return GenericMain(commands) + return GenericMain(commands, + override={"tag_type": constants.TAG_NODEGROUP}) diff --git a/man/gnt-group.rst b/man/gnt-group.rst index 068ef4a7a48fc17f4c25d06f047d4cee07bd6130..2569bc0230cf6bb00bf8d1ce94433add87bd0e6e 100644 --- a/man/gnt-group.rst +++ b/man/gnt-group.rst @@ -137,6 +137,45 @@ RENAME Renames a given group from *oldname* to *newname*. + +TAGS +~~~~ + +ADD-TAGS +^^^^^^^^ + +**add-tags** [--from *file*] {*groupname*} {*tag*...} + +Add tags to the given node group. If any of the tags contains invalid +characters, the entire operation will abort. + +If the ``--from`` option is given, the list of tags will be extended +with the contents of that file (each line becomes a tag). In this case, +there is not need to pass tags on the command line (if you do, both +sources will be used). A file name of ``-`` will be interpreted as +stdin. + +LIST-TAGS +^^^^^^^^^ + +**list-tags** {*groupname*} + +List the tags of the given node group. + +REMOVE-TAGS +^^^^^^^^^^^ + +**remove-tags** [--from *file*] {*groupname*} {*tag*...} + +Remove tags from the given node group. If any of the tags are not +existing on the node, the entire operation will abort. + +If the ``--from`` option is given, the list of tags to be removed will +be extended with the contents of that file (each line becomes a tag). In +this case, there is not need to pass tags on the command line (if you +do, tags from both sources will be removed). A file name of ``-`` will +be interpreted as stdin. + .. vim: set textwidth=72 : .. Local Variables: .. mode: rst