diff options
| author | Steven Hardy <shardy@redhat.com> | 2013-11-18 18:53:56 +0000 |
|---|---|---|
| committer | Steven Hardy <shardy@redhat.com> | 2013-11-27 19:13:05 +0000 |
| commit | be6852bf323e55354c70b7b1fdfd90d4554f9534 (patch) | |
| tree | 20e207a540f1a6f7f0fe6b45e73d08388d153dac | |
| parent | 845018fbf3717d2758c8073d9da11a20882b31f9 (diff) | |
| download | python-heatclient-be6852bf323e55354c70b7b1fdfd90d4554f9534.tar.gz | |
Pass only tenant name or ID to keystoneclient
When creating the keystoneclient, we only need to pass the tenant
ID or name, not both
Change-Id: I0dd03759979026daba1be343f7194f9b7e15a589
| -rw-r--r-- | heatclient/shell.py | 15 | ||||
| -rw-r--r-- | heatclient/tests/fakes.py | 1 |
2 files changed, 9 insertions, 7 deletions
diff --git a/heatclient/shell.py b/heatclient/shell.py index 0abaf00..56ce087 100644 --- a/heatclient/shell.py +++ b/heatclient/shell.py @@ -220,12 +220,15 @@ class HeatShell(object): :param tenant_name: name of tenant :param auth_url: endpoint to authenticate against """ - return ksclient.Client(username=kwargs.get('username'), - password=kwargs.get('password'), - tenant_id=kwargs.get('tenant_id'), - tenant_name=kwargs.get('tenant_name'), - auth_url=kwargs.get('auth_url'), - insecure=kwargs.get('insecure')) + kc_args = {'auth_url': kwargs.get('auth_url'), + 'insecure': kwargs.get('insecure'), + 'username': kwargs.get('username'), + 'password': kwargs.get('password')} + if kwargs.get('tenant_id'): + kc_args['tenant_id'] = kwargs.get('tenant_id') + else: + kc_args['tenant_name'] = kwargs.get('tenant_name') + return ksclient.Client(**kc_args) def _get_endpoint(self, client, **kwargs): """Get an endpoint using the provided keystone client.""" diff --git a/heatclient/tests/fakes.py b/heatclient/tests/fakes.py index 199dad9..51ef8fa 100644 --- a/heatclient/tests/fakes.py +++ b/heatclient/tests/fakes.py @@ -22,7 +22,6 @@ def script_keystone_client(): ksclient.Client(auth_url='http://no.where', insecure=False, password='password', - tenant_id='', tenant_name='tenant_name', username='username').AndReturn(FakeKeystone('abcd1234')) |
