This was already unified inside gnt-instance, I just moved that
definition (and upper-cased it) into cli.py.
---
lib/cli.py | 5 +++++
scripts/gnt-debug | 4 +---
scripts/gnt-instance | 8 ++------
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/lib/cli.py b/lib/cli.py
index 180aa27..dbea1d7 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -56,6 +56,7 @@ __all__ = [
"NOHDR_OPT",
"NONICS_OPT",
"NWSYNC_OPT",
+ "OS_OPT",
"SEP_OPT",
"SUBMIT_OPT",
"SYNC_OPT",
@@ -506,6 +507,10 @@ IALLOCATOR_OPT = cli_option("-I", "--iallocator",
metavar="<NAME>",
default=None, type="string",
completion_suggest=OPT_COMPL_ONE_IALLOCATOR)
+OS_OPT = cli_option("-o", "--os-type", dest="os", help="What OS to run",
+ metavar="<os>",
+ completion_suggest=OPT_COMPL_ONE_OS)
+
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
diff --git a/scripts/gnt-debug b/scripts/gnt-debug
index d31d082..e8be29f 100755
--- a/scripts/gnt-debug
+++ b/scripts/gnt-debug
@@ -200,9 +200,7 @@ commands = {
help="Comma separated list of nics, each nic"
" definition is of form mac/ip/bridge, if"
" missing values are replace by None"),
- cli_option("-o", "--os-type", default=None,
- help="Select os for the instance",
- completion_suggest=OPT_COMPL_ONE_OS),
+ OS_OPT,
cli_option("-p", "--vcpus", default=1, type="int",
help="Select number of VCPUs for the instance"),
cli_option("--tags", default=None,
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 7aa4ad4..d1c2b31 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1333,10 +1333,6 @@ node_opt = cli_option("-n", "--node", dest="node",
help="Target node",
metavar="<node>",
completion_suggest=OPT_COMPL_ONE_NODE)
-os_opt = cli_option("-o", "--os-type", dest="os", help="What OS to run",
- metavar="<os>",
- completion_suggest=OPT_COMPL_ONE_OS)
-
# multi-instance selection options
m_force_multi = cli_option("--force-multiple", dest="force_multi",
help="Do not ask for confirmation when more than"
@@ -1371,7 +1367,7 @@ add_opts = [
help="Target node and optional secondary node",
metavar="<pnode>[:<snode>]",
completion_suggest=OPT_COMPL_INST_ADD_NODES),
- os_opt,
+ OS_OPT,
cli_option("-B", "--backend", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
@@ -1485,7 +1481,7 @@ commands = {
" list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
),
'reinstall': (ReinstallInstance, [ArgInstance(min=1)],
- [DEBUG_OPT, FORCE_OPT, os_opt,
+ [DEBUG_OPT, FORCE_OPT, OS_OPT,
m_force_multi,
m_node_opt, m_pri_node_opt, m_sec_node_opt,
m_clust_opt, m_inst_opt,
--
1.6.3.3