← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1092605] Re: Inconsistency between nova-manage help message and actual usage.

 

nova-manage is largely not used beyond db-sync at this point, marking as
invalid because I think this is probably quite out of date.

** Changed in: nova
     Assignee: Mark McLoughlin (markmc) => (unassigned)

** Changed in: nova
       Status: In Progress => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1092605

Title:
  Inconsistency between nova-manage help message and actual usage.

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  In current implementation, a lot of optional arguments for nova-manage
  sub actions are required (aka non-optional).

  For example:
  $nova-manage shell script -h
   usage: nova-manage shell script [-h] [--path <path>]
                                  [action_args [action_args ...]]

  positional arguments:
    action_args

  optional arguments:
    -h, --help     show this help message and exit
    --path <path>  Script path

  What the help message says is, --path is optional, which means user
  can safely ignore this argument but in fact they can't.

  $nova-manage shell script
  Runs the script from the specifed path with flags set properly.
          arguments: path
  An argument is missing: path

  It seems 'nova-manage' detect a missing argument but that's confusing
  and inconsistent.  Why the helpl message doesn't suggest so?

  Looking into the implementation, nova-manage relies on a cliutils
  module from oslo to do argument inspection.  This is kind of an
  indirect and inefficient way to do it.  The argparse module (used by
  oslo cfg module) is able to do argument checking when parsing
  arguments.  nova-manage failed to do this due to incorrect usage of
  @args decorator:

  -----------------
  @@ -202,7 +202,7 @@ class ShellCommands(object):
                   readline.parse_and_bind("tab:complete")
               code.interact()
   
  -    @args('--path', dest='path', metavar='<path>', help='Script path')
  +    @args('--path', required=True, dest='path', metavar='<path>', help='Script path')
       def script(self, path):

  Simply adding a 'required=True' to @args allows argparse module to
  detect incorrect input as well as generate consistent help message.
  And cliutils module is _not_ needed any more.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1092605/+subscriptions