summaryrefslogtreecommitdiff
path: root/openstackclient/api/auth.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-02-21 04:31:50 +0000
committerGerrit Code Review <review@openstack.org>2016-02-21 04:31:51 +0000
commit867bcb0db8742fd2daa5c91dfd3c164ac4178f18 (patch)
treeab6312faf2d924879996e74bdfd5492b4f459598 /openstackclient/api/auth.py
parentf4ca06cad6348b2a00d72d65c7a1c2f56e8df1d4 (diff)
parent41e1bd0be64e15a5e0c12b45bdf3dcde5fabf244 (diff)
downloadpython-openstackclient-867bcb0db8742fd2daa5c91dfd3c164ac4178f18.tar.gz
Merge "Support unscoped token request"
Diffstat (limited to 'openstackclient/api/auth.py')
-rw-r--r--openstackclient/api/auth.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/openstackclient/api/auth.py b/openstackclient/api/auth.py
index 44287318..e675692e 100644
--- a/openstackclient/api/auth.py
+++ b/openstackclient/api/auth.py
@@ -135,8 +135,12 @@ def build_auth_params(auth_plugin_name, cmd_options):
return (auth_plugin_class, auth_params)
-def check_valid_auth_options(options, auth_plugin_name):
- """Perform basic option checking, provide helpful error messages"""
+def check_valid_auth_options(options, auth_plugin_name, required_scope=True):
+ """Perform basic option checking, provide helpful error messages.
+
+ :param required_scope: indicate whether a scoped token is required
+
+ """
msg = ''
if auth_plugin_name.endswith('password'):
@@ -146,7 +150,8 @@ def check_valid_auth_options(options, auth_plugin_name):
if not options.auth.get('auth_url', None):
msg += _('Set an authentication URL, with --os-auth-url,'
' OS_AUTH_URL or auth.auth_url\n')
- if (not options.auth.get('project_id', None) and not
+ if (required_scope and not
+ options.auth.get('project_id', None) and not
options.auth.get('domain_id', None) and not
options.auth.get('domain_name', None) and not
options.auth.get('project_name', None) and not