diff options
author | Chmouel Boudjnah <chmouel@chmouel.com> | 2012-06-14 14:28:09 +0000 |
---|---|---|
committer | Chmouel Boudjnah <chmouel@chmouel.com> | 2012-06-27 19:19:37 +0000 |
commit | 2bcfe0b4c82ed3a333e3ffcf1d11423d57c2b761 (patch) | |
tree | a00912a6d122021abfc0c963a654a86da3f12c75 /swiftclient/client.py | |
parent | 8396e3a4cb3daa6946844c23af22e01f44671834 (diff) | |
download | python-swiftclient-2bcfe0b4c82ed3a333e3ffcf1d11423d57c2b761.tar.gz |
Allow specify tenant:user in user.
We allow having the syntax tenant:user in user since this would make
things easier when switching from auth 1.0 to auth 2.0 and not having to
specify a tenant_name.
In the feature we should use the auth functions from keystoneclient and
be done with those changes, we could then auth by user/tenant-ID.
Change-Id: Ie49748105a678fb9369494e77d41d934d57a39a7
Diffstat (limited to 'swiftclient/client.py')
-rw-r--r-- | swiftclient/client.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index 2b78060..79e6594 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -282,6 +282,8 @@ def get_auth(url, user, key, snet=False, tenant_name=None, auth_version="1.0"): if auth_version in ["1.0", "1"]: return _get_auth_v1_0(url, user, key, snet) elif auth_version in ["2.0", "2"]: + if not tenant_name and ':' in user: + (tenant_name, user) = user.split(':') if not tenant_name: raise ClientException('No tenant specified') return _get_auth_v2_0(url, user, tenant_name, key, snet) |