From: Steve Baker Date: Wed, 17 Jul 2013 02:30:58 +0000 (+1200) Subject: Move url_for into heat_keystoneclient. X-Git-Tag: 2014.1~351^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b02b8260831ee2ab8fed1ba22ab947a499e1a003;p=openstack-build%2Fheat-build.git Move url_for into heat_keystoneclient. This allows faking of this call, and removes one instance of accessing the encapsulated keystone client. Change-Id: Iad2a9aaad2e9f1dc3cbeb509c822a61427f12817 --- diff --git a/heat/common/heat_keystoneclient.py b/heat/common/heat_keystoneclient.py index f9bb9b60..737a2529 100644 --- a/heat/common/heat_keystoneclient.py +++ b/heat/common/heat_keystoneclient.py @@ -151,3 +151,6 @@ class KeystoneClient(object): def enable_stack_user(self, user_id): # FIXME : This won't work with the v3 keystone API self.client.users.update_enabled(user_id, True) + + def url_for(self, **kwargs): + return self.client.service_catalog.url_for(**kwargs) diff --git a/heat/engine/clients.py b/heat/engine/clients.py index 84f1d0f5..22301d5a 100644 --- a/heat/engine/clients.py +++ b/heat/engine/clients.py @@ -69,7 +69,7 @@ class OpenStackClients(object): return self._keystone def url_for(self, **kwargs): - return self.keystone().client.service_catalog.url_for(**kwargs) + return self.keystone().url_for(**kwargs) def nova(self, service_type='compute'): if service_type in self._nova: diff --git a/heat/tests/fakes.py b/heat/tests/fakes.py index 124bd4d0..0833f2fe 100644 --- a/heat/tests/fakes.py +++ b/heat/tests/fakes.py @@ -133,3 +133,6 @@ class FakeKeystoneClient(): def disable_stack_user(self, user_id): pass + + def url_for(self, **kwargs): + return 'http://example.com:1234/v1'