summaryrefslogtreecommitdiff
path: root/openstackclient/api
diff options
context:
space:
mode:
authorMadhu Mohan Nelemane <mmnelemane@suse.com>2016-04-27 18:43:57 +0200
committerGuang Yee <guang.yee@hpe.com>2016-05-19 18:07:53 -0700
commita4d4e81c88da400d4ec62fb9fdc00eeeafafc0e5 (patch)
treecbc050d59439635df016e9a5eb8e2b12a29a7460 /openstackclient/api
parent74162fa31a3c34ee08472f24318f1c326b493330 (diff)
downloadpython-openstackclient-a4d4e81c88da400d4ec62fb9fdc00eeeafafc0e5.tar.gz
Avoid TypeError on message object additions
Change-Id: I634c1e158e93eeb55ab17fef8a0715b6678dffec Closes-Bug: #1575787
Diffstat (limited to 'openstackclient/api')
-rw-r--r--openstackclient/api/auth.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/openstackclient/api/auth.py b/openstackclient/api/auth.py
index 3d6f7bcf..c74e8005 100644
--- a/openstackclient/api/auth.py
+++ b/openstackclient/api/auth.py
@@ -142,14 +142,14 @@ def check_valid_auth_options(options, auth_plugin_name, required_scope=True):
"""
- msg = ''
+ msgs = []
if auth_plugin_name.endswith('password'):
if not options.auth.get('username'):
- msg += _('Set a username with --os-username, OS_USERNAME,'
- ' or auth.username\n')
+ msgs.append(_('Set a username with --os-username, OS_USERNAME,'
+ ' or auth.username'))
if not options.auth.get('auth_url'):
- msg += _('Set an authentication URL, with --os-auth-url,'
- ' OS_AUTH_URL or auth.auth_url\n')
+ msgs.append(_('Set an authentication URL, with --os-auth-url,'
+ ' OS_AUTH_URL or auth.auth_url'))
if (required_scope and not
options.auth.get('project_id') and not
options.auth.get('domain_id') and not
@@ -157,24 +157,28 @@ def check_valid_auth_options(options, auth_plugin_name, required_scope=True):
options.auth.get('project_name') and not
options.auth.get('tenant_id') and not
options.auth.get('tenant_name')):
- msg += _('Set a scope, such as a project or domain, set a '
- 'project scope with --os-project-name, OS_PROJECT_NAME '
- 'or auth.project_name, set a domain scope with '
- '--os-domain-name, OS_DOMAIN_NAME or auth.domain_name')
+ msgs.append(_('Set a scope, such as a project or domain, set a '
+ 'project scope with --os-project-name, '
+ 'OS_PROJECT_NAME or auth.project_name, set a domain '
+ 'scope with --os-domain-name, OS_DOMAIN_NAME or '
+ 'auth.domain_name'))
elif auth_plugin_name.endswith('token'):
if not options.auth.get('token'):
- msg += _('Set a token with --os-token, OS_TOKEN or auth.token\n')
+ msgs.append(_('Set a token with --os-token, OS_TOKEN or '
+ 'auth.token'))
if not options.auth.get('auth_url'):
- msg += _('Set a service AUTH_URL, with --os-auth-url, '
- 'OS_AUTH_URL or auth.auth_url\n')
+ msgs.append(_('Set a service AUTH_URL, with --os-auth-url, '
+ 'OS_AUTH_URL or auth.auth_url'))
elif auth_plugin_name == 'token_endpoint':
if not options.auth.get('token'):
- msg += _('Set a token with --os-token, OS_TOKEN or auth.token\n')
+ msgs.append(_('Set a token with --os-token, OS_TOKEN or '
+ 'auth.token'))
if not options.auth.get('url'):
- msg += _('Set a service URL, with --os-url, OS_URL or auth.url\n')
+ msgs.append(_('Set a service URL, with --os-url, OS_URL or '
+ 'auth.url'))
- if msg:
- raise exc.CommandError('Missing parameter(s): \n%s' % msg)
+ if msgs:
+ raise exc.CommandError('Missing parameter(s): \n%s' % '\n'.join(msgs))
def build_auth_plugins_option_parser(parser):