Commit 7edc4637 authored by Iustin Pop's avatar Iustin Pop
Browse files

Unify the “--node” (as list of nodes) option

Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 990b7886
......@@ -61,6 +61,7 @@ __all__ = [
......@@ -580,6 +581,12 @@ NODE_PLACEMENT_OPT = cli_option("-n", "--node", dest="node",
NODE_LIST_OPT = cli_option("-n", "--node", dest="nodes", default=[],
action="append", metavar="<node>",
help="Use only this node (can be used multiple"
" times, if not given defaults to all nodes)",
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
......@@ -233,12 +233,7 @@ import_opts = [
commands = {
'list': (PrintExportList, ARGS_NONE,
cli_option("--node", dest="nodes", default=[], action="append",
help="List only backups stored on this node"
" (can be used multiple times)",
"", "Lists instance exports available in the ganeti cluster"),
'export': (ExportInstance, ARGS_ONE_INSTANCE,
......@@ -586,13 +586,6 @@ def WatcherOps(opts, args):
return 0
# this is an option common to more than one command, so we declare
# it here and reuse it
node_option = cli_option("-n", "--node", action="append", dest="nodes",
help="Node to copy to (if not given, all nodes),"
" can be given multiple times",
metavar="<node>", default=[])
commands = {
'init': (InitCluster, [ArgHost(min=1, max=1)],
......@@ -688,10 +681,11 @@ commands = {
'getmaster': (ShowClusterMaster, ARGS_NONE, [DEBUG_OPT],
"", "Shows the cluster master"),
'copyfile': (ClusterCopyFile, [ArgFile(min=1, max=1)],
[DEBUG_OPT, node_option],
"[-n node...] <filename>",
"Copies a file to all (or only some) nodes"),
'command': (RunClusterCommand, [ArgCommand(min=1)], [DEBUG_OPT, node_option],
'command': (RunClusterCommand, [ArgCommand(min=1)],
"[-n node...] <command>",
"Runs a command on all (or only some) nodes"),
'info': (ShowClusterConfig, ARGS_NONE, [DEBUG_OPT],
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