diff --git a/manilaclient/client.py b/manilaclient/client.py index e9e8ff1af..29616911a 100644 --- a/manilaclient/client.py +++ b/manilaclient/client.py @@ -217,6 +217,7 @@ class HTTPClient(object): if extract_token: self.auth_token = self.service_catalog.get_token() + self.tenant_id = self.service_catalog.get_tenant_id() management_url = self.service_catalog.url_for( attr='region', diff --git a/manilaclient/service_catalog.py b/manilaclient/service_catalog.py index 9de3aa32b..e4d8d83a9 100644 --- a/manilaclient/service_catalog.py +++ b/manilaclient/service_catalog.py @@ -28,6 +28,9 @@ class ServiceCatalog(object): def get_token(self): return self.catalog['access']['token']['id'] + def get_tenant_id(self): + return self.catalog['access']['token']['tenant']['id'] + def url_for(self, attr=None, filter_value=None, service_type=None, endpoint_type='publicURL', service_name=None, share_service_name=None): diff --git a/tests/v1/test_auth.py b/tests/v1/test_auth.py index d643162e4..65dfbd549 100644 --- a/tests/v1/test_auth.py +++ b/tests/v1/test_auth.py @@ -33,6 +33,9 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): "token": { "expires": "12345", "id": "FAKE_ID", + "tenant": { + "id": "FAKE_TENANT_ID" + }, }, "serviceCatalog": [ { @@ -190,6 +193,9 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): "token": { "expires": "12345", "id": "FAKE_ID", + "tenant": { + "id": "FAKE_TENANT_ID" + }, }, "serviceCatalog": [ { @@ -274,6 +280,9 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): "token": { "expires": "12345", "id": "FAKE_ID", + "tenant": { + "id": "FAKE_TENANT_ID" + }, }, "serviceCatalog": [ {