From bdd048e76c36e0a3ae787c5dedfa06868abc6229 Mon Sep 17 00:00:00 2001 From: bhagyashris Date: Tue, 13 Jun 2017 18:15:25 +0530 Subject: [PATCH] Remove get_service method from compute If a get_service method is called with a valid service id, then it raises ResourceNotFound exception as this API is not implemented in nova. Removed this method and related test cases to cleanup the code. Closes-Bug: #1697687 Change-Id: I4086f4731fc653d721fe879b718b117327460933 --- doc/source/users/proxies/compute.rst | 1 - openstack/compute/v2/_proxy.py | 14 -------------- openstack/compute/v2/service.py | 1 - openstack/tests/unit/compute/v2/test_proxy.py | 4 ---- openstack/tests/unit/compute/v2/test_service.py | 2 +- 5 files changed, 1 insertion(+), 21 deletions(-) diff --git a/doc/source/users/proxies/compute.rst b/doc/source/users/proxies/compute.rst index 5a5f2536..3851966d 100644 --- a/doc/source/users/proxies/compute.rst +++ b/doc/source/users/proxies/compute.rst @@ -103,7 +103,6 @@ Service Operations .. autoclass:: openstack.compute.v2._proxy.Proxy - .. automethod:: openstack.compute.v2._proxy.Proxy.get_service .. automethod:: openstack.compute.v2._proxy.Proxy.services .. automethod:: openstack.compute.v2._proxy.Proxy.enable_service .. automethod:: openstack.compute.v2._proxy.Proxy.disable_service diff --git a/openstack/compute/v2/_proxy.py b/openstack/compute/v2/_proxy.py index 6d342d91..5f248d69 100644 --- a/openstack/compute/v2/_proxy.py +++ b/openstack/compute/v2/_proxy.py @@ -1056,20 +1056,6 @@ class Proxy(proxy2.BaseProxy): """ return self._get(_hypervisor.Hypervisor, hypervisor) - def get_service(self, service): - """Get a single service - - :param service: The value can be the ID of a serivce or a - :class:`~openstack.compute.v2.service.Service` - instance. - - :returns: - A :class:`~openstack.compute.v2.serivce.Service` object. - :raises: :class:`~openstack.exceptions.ResourceNotFound` - when no resource can be found. - """ - return self._get(_service.Service, service) - def force_service_down(self, service, host, binary): """Force a service down diff --git a/openstack/compute/v2/service.py b/openstack/compute/v2/service.py index 9a48a392..a36f67df 100644 --- a/openstack/compute/v2/service.py +++ b/openstack/compute/v2/service.py @@ -23,7 +23,6 @@ class Service(resource2.Resource): service = compute_service.ComputeService() # capabilities - allow_get = True allow_list = True allow_update = True diff --git a/openstack/tests/unit/compute/v2/test_proxy.py b/openstack/tests/unit/compute/v2/test_proxy.py index f50112fc..6beef34d 100644 --- a/openstack/tests/unit/compute/v2/test_proxy.py +++ b/openstack/tests/unit/compute/v2/test_proxy.py @@ -471,10 +471,6 @@ class TestComputeProxy(test_proxy_base2.TestProxyBase): self.verify_get(self.proxy.get_hypervisor, hypervisor.Hypervisor) - def test_get_service(self): - self.verify_get(self.proxy.get_service, - service.Service) - def test_services(self): self.verify_list_no_kwargs(self.proxy.services, service.Service, diff --git a/openstack/tests/unit/compute/v2/test_service.py b/openstack/tests/unit/compute/v2/test_service.py index b993b5ac..0872cf08 100644 --- a/openstack/tests/unit/compute/v2/test_service.py +++ b/openstack/tests/unit/compute/v2/test_service.py @@ -42,9 +42,9 @@ class TestService(testtools.TestCase): self.assertEqual('services', sot.resources_key) self.assertEqual('/os-services', sot.base_path) self.assertEqual('compute', sot.service.service_type) - self.assertTrue(sot.allow_get) self.assertTrue(sot.allow_update) self.assertTrue(sot.allow_list) + self.assertFalse(sot.allow_get) def test_make_it(self): sot = service.Service(**EXAMPLE)