From 6e9616718e64f21564c4601d168426e64c893032 Mon Sep 17 00:00:00 2001 From: kairat_kushaev Date: Fri, 22 May 2015 18:35:10 +0300 Subject: [PATCH] Delete deprecated old-style client access As stated in https://etherpad.openstack.org/p/YVR-heat-liberty-deprecation it had better to delete old-style access to openstack clients. Change-Id: I2a7f08afae45aae4e5ce43f76c2e5a1e16cbd563 --- heat/engine/clients/__init__.py | 50 ------------------- .../resources/openstack/heat/remote_stack.py | 2 +- heat/tests/test_remote_stack.py | 6 +-- 3 files changed, 4 insertions(+), 54 deletions(-) diff --git a/heat/engine/clients/__init__.py b/heat/engine/clients/__init__.py index 71be4565ab..81032ba32c 100644 --- a/heat/engine/clients/__init__.py +++ b/heat/engine/clients/__init__.py @@ -11,8 +11,6 @@ # License for the specific language governing permissions and limitations # under the License. -import warnings - from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils @@ -79,54 +77,6 @@ class OpenStackClients(object): # auth_token expiry (e.g trust_id or username/password) return self.client('keystone').auth_token - def keystone(self): - warnings.warn('keystone() is deprecated. ' - 'Replace with calls to client("keystone")') - return self.client('keystone') - - def url_for(self, **kwargs): - return self.client('keystone').url_for(**kwargs) - - def nova(self): - warnings.warn('nova() is deprecated. ' - 'Replace with calls to client("nova")') - return self.client('nova') - - def swift(self): - warnings.warn('swift() is deprecated. ' - 'Replace with calls to client("swift")') - return self.client('swift') - - def glance(self): - warnings.warn('glance() is deprecated. ' - 'Replace with calls to client("glance")') - return self.client('glance') - - def neutron(self): - warnings.warn('neutron() is deprecated. ' - 'Replace with calls to client("neutron")') - return self.client('neutron') - - def cinder(self): - warnings.warn('cinder() is deprecated. ' - 'Replace with calls to client("cinder")') - return self.client('cinder') - - def trove(self): - warnings.warn('trove() is deprecated. ' - 'Replace with calls to client("trove")') - return self.client('trove') - - def ceilometer(self): - warnings.warn('ceilometer() is deprecated. ' - 'Replace with calls to client("ceilometer")') - return self.client('ceilometer') - - def heat(self): - warnings.warn('heat() is deprecated. ' - 'Replace with calls to client("heat")') - return self.client('heat') - class ClientBackend(object): '''Delay choosing the backend client module until the client's class needs diff --git a/heat/engine/resources/openstack/heat/remote_stack.py b/heat/engine/resources/openstack/heat/remote_stack.py index 9ea61cd253..4f9834f00b 100644 --- a/heat/engine/resources/openstack/heat/remote_stack.py +++ b/heat/engine/resources/openstack/heat/remote_stack.py @@ -116,7 +116,7 @@ class RemoteStack(resource.Resource): def heat(self): # A convenience method overriding Resource.heat() - return self._context().clients.heat() + return self._context().clients.client("heat") def client_plugin(self): # A convenience method overriding Resource.client_plugin() diff --git a/heat/tests/test_remote_stack.py b/heat/tests/test_remote_stack.py index 5e2045a6c3..aaef79b130 100644 --- a/heat/tests/test_remote_stack.py +++ b/heat/tests/test_remote_stack.py @@ -106,7 +106,7 @@ class FakeClients(object): self.hc = None self.plugin = None - def heat(self): + def client(self, name): if self.region_name in ['RegionOne', 'RegionTwo']: if self.hc is None: self.hc = mock.MagicMock() @@ -147,7 +147,7 @@ class RemoteStackTest(tests_common.HeatTestCase): def initialize(self): parent, rsrc = self.create_parent_stack(remote_region='RegionTwo') self.parent = parent - self.heat = rsrc._context().clients.heat() + self.heat = rsrc._context().clients.client("heat") self.client_plugin = rsrc._context().clients.client_plugin('heat') def create_parent_stack(self, remote_region=None, custom_template=None): @@ -270,7 +270,7 @@ class RemoteStackTest(tests_common.HeatTestCase): # not setting or using self.heat because this test case is a special # one with the RemoteStack resource initialized but not created. - heat = rsrc._context().clients.heat() + heat = rsrc._context().clients.client("heat") # heatclient.exc.BadRequest is the exception returned by a failed # validation