diff options
| author | Jamie Lennox <jamielennox@redhat.com> | 2015-05-31 13:37:50 +1000 |
|---|---|---|
| committer | Jamie Lennox <jamielennox@redhat.com> | 2015-05-31 15:03:42 +1000 |
| commit | 3ae247fdceac0e2c7bb6160f9ffefc4ad5d8da29 (patch) | |
| tree | 4799e829cd7034810aba68aefd34f1511259c421 /openstackclient/api | |
| parent | 211c14c638b9bf393932be42d4f04a4dd12a84bc (diff) | |
| download | python-openstackclient-3ae247fdceac0e2c7bb6160f9ffefc4ad5d8da29.tar.gz | |
Set tenant options on parsed namespace
Because of the way OSC registers all plugins together we end up
with os-tenant-X parameters being saved to the project-X attribute after
parsing. If you are using the v2 plugins directly then they and os-client-config
expect the tenant_X values and will assuming no scoping information if
they are not present.
Validating options for scope will also fail in this situation, not just
because the resultant auth dictionary is missing the tenant-X
attributes, but because OSC validates that either project or domain
scope information is present.
Fix this by just always setting the v2 parameters if the v3 parameters
are present. This will have no effect on the generic or v3 case but fix
the v2 case.
Expand validation to include the tenant options so it knows that v2
plugins are scoped.
Change-Id: I8cab3e423663f801cbf2d83106c671bddc58d7e6
Closes-Bug: #1460369
Diffstat (limited to 'openstackclient/api')
| -rw-r--r-- | openstackclient/api/auth.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/openstackclient/api/auth.py b/openstackclient/api/auth.py index 9fb26e71..1d50f92c 100644 --- a/openstackclient/api/auth.py +++ b/openstackclient/api/auth.py @@ -149,7 +149,9 @@ def check_valid_auth_options(options, auth_plugin_name): if (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)): + options.auth.get('project_name', None) and not + options.auth.get('tenant_id', None) and not + options.auth.get('tenant_name', None)): msg += _('Set a scope, such as a project or domain, with ' '--os-project-name, OS_PROJECT_NAME or auth.project_name') elif auth_plugin_name.endswith('token'): |
