summaryrefslogtreecommitdiff
path: root/openstackclient/common/clientmanager.py
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@redhat.com>2015-05-31 13:37:50 +1000
committerJamie Lennox <jamielennox@redhat.com>2015-05-31 15:03:42 +1000
commit3ae247fdceac0e2c7bb6160f9ffefc4ad5d8da29 (patch)
tree4799e829cd7034810aba68aefd34f1511259c421 /openstackclient/common/clientmanager.py
parent211c14c638b9bf393932be42d4f04a4dd12a84bc (diff)
downloadpython-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/common/clientmanager.py')
-rw-r--r--openstackclient/common/clientmanager.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py
index 85e367c4..6311c71a 100644
--- a/openstackclient/common/clientmanager.py
+++ b/openstackclient/common/clientmanager.py
@@ -139,6 +139,7 @@ class ClientManager(object):
# PROJECT_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability.
if (self._api_version.get('identity') == '3' and
not self._auth_params.get('project_domain_id', None) and
+ not self.auth_plugin_name.startswith('v2') and
not self._auth_params.get('project_domain_name', None)):
self._auth_params['project_domain_id'] = default_domain
@@ -147,6 +148,7 @@ class ClientManager(object):
# to 'OS_DEFAULT_DOMAIN' for better usability.
if (self._api_version.get('identity') == '3' and
self.auth_plugin_name.endswith('password') and
+ not self.auth_plugin_name.startswith('v2') and
not self._auth_params.get('user_domain_id', None) and
not self._auth_params.get('user_domain_name', None)):
self._auth_params['user_domain_id'] = default_domain