diff options
author | Erno Kuvaja <jokke@usr.fi> | 2015-09-10 10:10:06 +0000 |
---|---|---|
committer | Erno Kuvaja <jokke@usr.fi> | 2015-09-11 12:56:08 +0000 |
commit | 160825f909cb1e0f876c2a040dbfb5aae5fd01d4 (patch) | |
tree | 6c0c6a9771e37b6f1e4291d77538382267fd2462 /glanceclient/shell.py | |
parent | 337b2dce72726a90200bf89960e033f83888fd73 (diff) | |
download | python-glanceclient-160825f909cb1e0f876c2a040dbfb5aae5fd01d4.tar.gz |
Fixes CLI client called without subcommands
If CLI client is called without any subcommands or arguments it will
fail with """'Namespace' object has no attribute 'command'""". This
is coming from the getattr which does not have alternate value
specified.
Closes-Bug: #1494259
Change-Id: I461f0d4a91f3af2224bafc14a88572a8e4a3c051
Diffstat (limited to 'glanceclient/shell.py')
-rwxr-xr-x | glanceclient/shell.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 065e9d6..faa014c 100755 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -717,7 +717,7 @@ class OpenStackImagesShell(object): help='Display help for <subcommand>.') def do_help(self, args, parser): """Display help about this program or one of its subcommands.""" - command = getattr(args, 'command') or '' + command = getattr(args, 'command', '') if command: if args.command in self.subcommands: @@ -725,13 +725,14 @@ class OpenStackImagesShell(object): else: raise exc.CommandError("'%s' is not a valid subcommand" % args.command) + command = ' ' + command else: parser.print_help() if not args.os_image_api_version or args.os_image_api_version == '2': print() print(("Run `glance --os-image-api-version 1 help%s` " - "for v1 help") % (' ' + command)) + "for v1 help") % command) def do_bash_completion(self, _args): """Prints arguments for bash_completion. |