Implement 'out' direction on allocator tests
[ganeti-local] / lib / cli.py
index d2bcf6f..72e32aa 100644 (file)
@@ -167,7 +167,8 @@ USEUNITS_OPT = make_option("--human-readable", default=False,
                            help="Print sizes in human readable format")
 
 FIELDS_OPT = make_option("-o", "--output", dest="output", action="store",
-                         type="string", help="Select output fields",
+                         type="string", help="Comma separated list of"
+                         " output fields",
                          metavar="FIELDS")
 
 FORCE_OPT = make_option("-f", "--force", dest="force", action="store_true",
@@ -176,6 +177,9 @@ FORCE_OPT = make_option("-f", "--force", dest="force", action="store_true",
 _LOCK_OPT = make_option("--lock-retries", default=None,
                         type="int", help=SUPPRESS_HELP)
 
+_LOCK_NOAUTOCLEAN = make_option("--lock-noautoclean", default=False,
+                                action="store_true", help=SUPPRESS_HELP)
+
 TAG_SRC_OPT = make_option("--from", dest="tags_source",
                           default=None, help="File with tag names")
 
@@ -280,6 +284,7 @@ def _ParseArgs(argv, commands, aliases):
 
   func, nargs, parser_opts, usage, description = commands[cmd]
   parser_opts.append(_LOCK_OPT)
+  parser_opts.append(_LOCK_NOAUTOCLEAN)
   parser = OptionParser(option_list=parser_opts,
                         description=description,
                         formatter=TitledHelpFormatter(),
@@ -474,7 +479,8 @@ def GenericMain(commands, override=None, aliases=None):
 
   utils.debug = options.debug
   try:
-    utils.Lock('cmd', max_retries=options.lock_retries, debug=options.debug)
+    utils.Lock('cmd', max_retries=options.lock_retries, debug=options.debug,
+               autoclean=not options.lock_noautoclean)
   except errors.LockError, err:
     logger.ToStderr(str(err))
     return 1