diff options
Diffstat (limited to 'glanceclient/shell.py')
-rwxr-xr-x | glanceclient/shell.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 9c8f572..2a77b69 100755 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -214,7 +214,8 @@ class OpenStackImagesShell(object): def _find_actions(self, subparsers, actions_module): for attr in (a for a in dir(actions_module) if a.startswith('do_')): - # I prefer to be hypen-separated instead of underscores. + # Replace underscores with hyphens in the commands + # displayed to the user command = attr[3:].replace('_', '-') callback = getattr(actions_module, attr) desc = callback.__doc__ or '' @@ -457,7 +458,7 @@ class OpenStackImagesShell(object): except OSError as e: # This avoids glanceclient to crash if it can't write to # ~/.glanceclient, which may happen on some env (for me, - # it happens in Jenkins, as Glanceclient can't write to + # it happens in Jenkins, as glanceclient can't write to # /var/lib/jenkins). msg = '%s' % e print(encodeutils.safe_decode(msg), file=sys.stderr) @@ -513,7 +514,7 @@ class OpenStackImagesShell(object): endpoint = self._get_image_url(options) endpoint, url_version = utils.strip_version(endpoint) except ValueError: - # NOTE(flaper87): ValueError is raised if no endpoint is povided + # NOTE(flaper87): ValueError is raised if no endpoint is provided url_version = None # build available subcommands based on version @@ -529,6 +530,7 @@ class OpenStackImagesShell(object): # Handle top-level --help/-h before attempting to parse # a command off the command line if options.help or not argv: + parser = _get_subparser(api_version) self.do_help(options, parser=parser) return 0 @@ -575,6 +577,12 @@ class OpenStackImagesShell(object): if not args.os_password and options.os_password: args.os_password = options.os_password + if args.debug: + # Set up the root logger to debug so that the submodules can + # print debug messages + logging.basicConfig(level=logging.DEBUG) + # for iso8601 < 0.1.11 + logging.getLogger('iso8601').setLevel(logging.WARNING) LOG = logging.getLogger('glanceclient') LOG.addHandler(logging.StreamHandler()) LOG.setLevel(logging.DEBUG if args.debug else logging.INFO) |