Unify the “--no-nics” option
authorIustin Pop <iustin@google.com>
Thu, 17 Sep 2009 08:59:55 +0000 (10:59 +0200)
committerIustin Pop <iustin@google.com>
Fri, 18 Sep 2009 10:53:49 +0000 (12:53 +0200)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/cli.py
scripts/gnt-backup
scripts/gnt-instance

index 3b1156c..be71648 100644 (file)
@@ -51,6 +51,7 @@ __all__ = [
   "FIELDS_OPT",
   "FORCE_OPT",
   "NOHDR_OPT",
+  "NONICS_OPT",
   "NWSYNC_OPT",
   "SEP_OPT",
   "SUBMIT_OPT",
@@ -482,6 +483,10 @@ DISK_TEMPLATE_OPT = cli_option("-t", "--disk-template", dest="disk_template",
                                default=None, metavar="TEMPL",
                                choices=list(constants.DISK_TEMPLATES))
 
+NONICS_OPT = cli_option("--no-nics", default=False, action="store_true",
+                        help="Do not create any network cards for"
+                        " the instance")
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
index 8ee9b67..372389d 100755 (executable)
@@ -231,8 +231,7 @@ import_opts = [
              default=[], dest="nics",
              action="append",
              type="identkeyval"),
-  cli_option("--no-nics", default=False, action="store_true",
-             help="Do not create any network cards for the instance"),
+  NONICS_OPT,
   NWSYNC_OPT,
   cli_option("--src-node", dest="src_node", help="Source node",
              metavar="<node>",
index 05b2a45..b4470db 100755 (executable)
@@ -1388,8 +1388,7 @@ add_opts = [
              default=[], dest="nics",
              action="append",
              type="identkeyval"),
-  cli_option("--no-nics", default=False, action="store_true",
-             help="Do not create any network cards for the instance"),
+  NONICS_OPT,
   NWSYNC_OPT,
   cli_option("--no-start", dest="start", default=True,
              action="store_false", help="Don't start the instance after"