From ab684474c9b1ca02b07c94473a87410e9b072bff Mon Sep 17 00:00:00 2001 From: Fei Long Wang Date: Thu, 7 Apr 2016 10:43:41 +1200 Subject: [PATCH] Fix Zaqar client issue Now the auth_tenat_id can't be accessible so we need another way to get the project/tenant id to create zaqar client. Change-Id: I352c83f64ffaee788653354437629517c63fb1a7 --- rally/osclients.py | 2 +- tests/unit/test_osclients.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rally/osclients.py b/rally/osclients.py index 20fd910d09..8c80e1b975 100644 --- a/rally/osclients.py +++ b/rally/osclients.py @@ -523,7 +523,7 @@ class Zaqar(OSClient): "os_username": self.credential.username, "os_password": self.credential.password, "os_project_name": self.credential.tenant_name, - "os_project_id": kc.auth_tenant_id, + "os_project_id": kc.auth_ref.get("token").get("tenant").get("id"), "os_auth_url": self.credential.auth_url, "insecure": self.credential.insecure, }}} diff --git a/tests/unit/test_osclients.py b/tests/unit/test_osclients.py index 2a34bd6225..111ded4427 100644 --- a/tests/unit/test_osclients.py +++ b/tests/unit/test_osclients.py @@ -568,6 +568,7 @@ class OSClientsTestCase(test.TestCase): mock_zaqar = mock.MagicMock() mock_zaqar.client.Client = mock.MagicMock(return_value=fake_zaqar) self.assertNotIn("zaqar", self.clients.cache) + p_id = self.fake_keystone.auth_ref.get("token").get("tenant").get("id") with mock.patch.dict("sys.modules", {"zaqarclient.queues": mock_zaqar}): client = self.clients.zaqar() @@ -581,7 +582,7 @@ class OSClientsTestCase(test.TestCase): "os_username": self.credential.username, "os_password": self.credential.password, "os_project_name": self.credential.tenant_name, - "os_project_id": self.fake_keystone.auth_tenant_id, + "os_project_id": p_id, "os_auth_url": self.credential.auth_url, "insecure": self.credential.insecure, }}}