summaryrefslogtreecommitdiff
path: root/novaclient/shell.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-09-17 20:50:44 +0000
committerGerrit Code Review <review@openstack.org>2015-09-17 20:50:44 +0000
commit4d5cfdead08601f6042a290a27d4ec50824fa2fb (patch)
tree02cabc1d2d3630a6127c4e4a51b7f36a2918e1ab /novaclient/shell.py
parent5c59684ae720d751a858bf8cd198eac013db3dc1 (diff)
parentb1204446ef17e7df244b23d7552da24a6d86b53f (diff)
downloadpython-novaclient-4d5cfdead08601f6042a290a27d4ec50824fa2fb.tar.gz
Merge "Fix nova bash-completion needs authentication"
Diffstat (limited to 'novaclient/shell.py')
-rw-r--r--novaclient/shell.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/novaclient/shell.py b/novaclient/shell.py
index 583cddb6..5da855aa 100644
--- a/novaclient/shell.py
+++ b/novaclient/shell.py
@@ -558,6 +558,10 @@ class OpenStackComputeShell(object):
do_help = ('help' in argv) or (
'--help' in argv) or ('-h' in argv) or not argv
+ # bash-completion should not require authentification
+ skip_auth = do_help or (
+ 'bash-completion' in argv)
+
# Discover available auth plugins
novaclient.auth_plugin.discover_auth_systems()
@@ -629,7 +633,7 @@ class OpenStackComputeShell(object):
# FIXME(usrleon): Here should be restrict for project id same as
# for os_username or os_password but for compatibility it is not.
- if must_auth and not do_help:
+ if must_auth and not skip_auth:
if auth_plugin:
auth_plugin.parse_opts(args)
@@ -686,8 +690,9 @@ class OpenStackComputeShell(object):
# set password for auth plugins
os_password = args.os_password
- if not do_help and not any([args.os_tenant_id, args.os_tenant_name,
- args.os_project_id, args.os_project_name]):
+ if (not skip_auth and
+ not any([args.os_tenant_id, args.os_tenant_name,
+ args.os_project_id, args.os_project_name])):
raise exc.CommandError(_("You must provide a project name or"
" project id via --os-project-name,"
" --os-project-id, env[OS_PROJECT_ID]"
@@ -695,7 +700,7 @@ class OpenStackComputeShell(object):
" use os-project and os-tenant"
" interchangeably."))
- if not os_auth_url and not do_help:
+ if not os_auth_url and not skip_auth:
raise exc.CommandError(
_("You must provide an auth url "
"via either --os-auth-url or env[OS_AUTH_URL]"))
@@ -717,7 +722,7 @@ class OpenStackComputeShell(object):
cacert=cacert, timeout=timeout,
session=keystone_session, auth=keystone_auth)
- if not do_help:
+ if not skip_auth:
if not api_version.is_latest():
if api_version > api_versions.APIVersion("2.0"):
if not api_version.matches(novaclient.API_MIN_VERSION,