summaryrefslogtreecommitdiff
path: root/openstackclient/shell.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-06-02 02:15:52 +0000
committerGerrit Code Review <review@openstack.org>2015-06-02 02:15:52 +0000
commit9bf24f3ae1f8bbf0003206d2e158b597bffe787f (patch)
tree87dcb4687c089b40fc0d5b6a1a54c69c6515c81a /openstackclient/shell.py
parent4d57e9f62a6d49fb7114ea718dda166f349d9341 (diff)
parent3ae247fdceac0e2c7bb6160f9ffefc4ad5d8da29 (diff)
downloadpython-openstackclient-9bf24f3ae1f8bbf0003206d2e158b597bffe787f.tar.gz
Merge "Set tenant options on parsed namespace"
Diffstat (limited to 'openstackclient/shell.py')
-rw-r--r--openstackclient/shell.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index 86d3fe3a..e6181683 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -234,6 +234,23 @@ class OpenStackShell(app.App):
cloud_config.set_default('auth_type', 'osc_password')
self.log.debug("options: %s", self.options)
+ project_id = getattr(self.options, 'project_id', None)
+ project_name = getattr(self.options, 'project_name', None)
+ tenant_id = getattr(self.options, 'tenant_id', None)
+ tenant_name = getattr(self.options, 'tenant_name', None)
+
+ # handle some v2/v3 authentication inconsistencies by just acting like
+ # both the project and tenant information are both present. This can
+ # go away if we stop registering all the argparse options together.
+ if project_id and not tenant_id:
+ self.options.tenant_id = project_id
+ if project_name and not tenant_name:
+ self.options.tenant_name = project_name
+ if tenant_id and not project_id:
+ self.options.project_id = tenant_id
+ if tenant_name and not project_name:
+ self.options.project_name = tenant_name
+
# Do configuration file handling
cc = cloud_config.OpenStackConfig()
self.log.debug("defaults: %s", cc.defaults)