From d3ed23ffde554646a00b6d561e0a97e642f0b04e Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Sep 2009 11:11:22 +0200
Subject: [PATCH] =?UTF-8?q?Unify=20the=20=E2=80=9C--os-type=E2=80=9D=20opt?=
 =?UTF-8?q?ion?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This was already unified inside gnt-instance, I just moved that
definition (and upper-cased it) into cli.py.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 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 180aa2735..dbea1d7a6 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 d31d082f8..e8be29f01 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 7aa4ad4d9..d1c2b31a6 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,
-- 
GitLab