From 16de7e004f0614982f7ae46b3dcef2bcad10d258 Mon Sep 17 00:00:00 2001 From: Pradeep Kilambi Date: Wed, 10 Jan 2018 14:28:35 -0500 Subject: [PATCH] Remove ceilometer actions from mistral ceilometer api and client have been deprecated for over two releases and now removed completely. Lets drop these actions and update the requirements. Change-Id: Ica2b835a885b9b4705996f91080afc12587bd314 --- mistral/actions/generator_factory.py | 2 +- mistral/actions/openstack/actions.py | 32 ------------------- mistral/actions/openstack/mapping.json | 29 ----------------- mistral/config.py | 2 +- .../unit/actions/openstack/test_generator.py | 1 - .../openstack/test_openstack_actions.py | 13 -------- ...rop-ceilometerclient-b33330a28906759e.yaml | 5 +++ requirements.txt | 1 - tools/get_action_list.py | 13 -------- 9 files changed, 7 insertions(+), 91 deletions(-) create mode 100644 releasenotes/notes/drop-ceilometerclient-b33330a28906759e.yaml diff --git a/mistral/actions/generator_factory.py b/mistral/actions/generator_factory.py index b7fd9358a..8ca409d81 100644 --- a/mistral/actions/generator_factory.py +++ b/mistral/actions/generator_factory.py @@ -18,7 +18,7 @@ from mistral.actions.openstack.action_generator import base SUPPORTED_MODULES = [ - 'Nova', 'Glance', 'Keystone', 'Heat', 'Neutron', 'Cinder', 'Ceilometer', + 'Nova', 'Glance', 'Keystone', 'Heat', 'Neutron', 'Cinder', 'Trove', 'Ironic', 'Baremetal Introspection', 'Swift', 'Zaqar', 'Barbican', 'Mistral', 'Designate', 'Magnum', 'Murano', 'Tacker', 'Aodh', 'Gnocchi', 'Glare' diff --git a/mistral/actions/openstack/actions.py b/mistral/actions/openstack/actions.py index a4ea787d1..bb36fbc7e 100644 --- a/mistral/actions/openstack/actions.py +++ b/mistral/actions/openstack/actions.py @@ -51,7 +51,6 @@ def _try_import(module_name): aodhclient = _try_import('aodhclient.v2.client') barbicanclient = _try_import('barbicanclient.client') -ceilometerclient = _try_import('ceilometerclient.v2.client') cinderclient = _try_import('cinderclient.client') designateclient = _try_import('designateclient.v1') glanceclient = _try_import('glanceclient') @@ -159,37 +158,6 @@ class KeystoneAction(base.OpenStackAction): return fake_client -class CeilometerAction(base.OpenStackAction): - _service_type = 'metering' - - @classmethod - def _get_client_class(cls): - return ceilometerclient.Client - - def _create_client(self, context): - - LOG.debug("Ceilometer action security context: %s", context) - - ceilometer_endpoint = self.get_service_endpoint() - - endpoint_url = keystone_utils.format_url( - ceilometer_endpoint.url, - {'tenant_id': context.project_id} - ) - - return self._get_client_class()( - endpoint_url, - region_name=ceilometer_endpoint.region, - token=context.auth_token, - username=context.user_name, - insecure=context.insecure - ) - - @classmethod - def _get_fake_client(cls): - return cls._get_client_class()("") - - class HeatAction(base.OpenStackAction): _service_type = 'orchestration' diff --git a/mistral/actions/openstack/mapping.json b/mistral/actions/openstack/mapping.json index 56dbcbe41..3ddd33f35 100644 --- a/mistral/actions/openstack/mapping.json +++ b/mistral/actions/openstack/mapping.json @@ -484,35 +484,6 @@ "template_versions_get": "template_versions.get", "template_versions_list": "template_versions.list" }, - "ceilometer": { - "_comment": "It uses ceilometerclient.v2.", - "alarms_create": "alarms.create", - "alarms_delete": "alarms.delete", - "alarms_get": "alarms.get", - "alarms_get_history": "alarms.get_history", - "alarms_get_state": "alarms.get_state", - "alarms_list": "alarms.list", - "alarms_set_state": "alarms.set_state", - "alarms_update": "alarms.update", - "capabilities_get": "capabilities.get", - "event_types_list": "event_types.list", - "events_get": "events.get", - "events_list": "events.list", - "meters_list": "meters.list", - "new_samples_get": "new_samples.get", - "new_samples_list": "new_samples.list", - "query_alarm_history_query": "query_alarm_history.query", - "query_alarms_query": "query_alarms.query", - "query_samples_query": "query_samples.query", - "resources_get": "resources.get", - "resources_list": "resources.list", - "samples_create": "samples.create", - "samples_create_list": "samples.create_list", - "samples_list": "samples.list", - "statistics_list": "statistics.list", - "trait_descriptions_list": "trait_descriptions.list", - "traits_list": "traits.list" - }, "aodh": { "_comment": "It uses aodhclient.v2.", "capabilities_list": "capabilities.list", diff --git a/mistral/config.py b/mistral/config.py index 4451b4e89..97b606002 100644 --- a/mistral/config.py +++ b/mistral/config.py @@ -363,7 +363,7 @@ openstack_actions_opts = [ ), cfg.ListOpt( 'modules-support-region', - default=['nova', 'glance', 'ceilometer', 'heat', 'neutron', 'cinder', + default=['nova', 'glance', 'heat', 'neutron', 'cinder', 'trove', 'ironic', 'designate', 'murano', 'tacker', 'senlin', 'aodh', 'gnocchi'], help=_('List of module names that support region in actions.') diff --git a/mistral/tests/unit/actions/openstack/test_generator.py b/mistral/tests/unit/actions/openstack/test_generator.py index ae6453ccd..2705995b7 100644 --- a/mistral/tests/unit/actions/openstack/test_generator.py +++ b/mistral/tests/unit/actions/openstack/test_generator.py @@ -38,7 +38,6 @@ MODULE_MAPPING = { 'heat': ['heat.stacks_list', actions.HeatAction], 'neutron': ['neutron.show_network', actions.NeutronAction], 'cinder': ['cinder.volumes_list', actions.CinderAction], - 'ceilometer': ['ceilometer.alarms_list', actions.CeilometerAction], 'trove': ['trove.instances_list', actions.TroveAction], 'ironic': ['ironic.node_list', actions.IronicAction], 'baremetal_introspection': ['baremetal_introspection.introspect', diff --git a/mistral/tests/unit/actions/openstack/test_openstack_actions.py b/mistral/tests/unit/actions/openstack/test_openstack_actions.py index 36d52c1f5..486e55c2b 100644 --- a/mistral/tests/unit/actions/openstack/test_openstack_actions.py +++ b/mistral/tests/unit/actions/openstack/test_openstack_actions.py @@ -109,19 +109,6 @@ class OpenStackActionTest(base.BaseTestCase): self.assertTrue(mocked().volumes.get.called) mocked().volumes.get.assert_called_once_with(volume="1234-abcd") - @mock.patch.object(actions.CeilometerAction, '_get_client') - def test_ceilometer_action(self, mocked): - mock_ctx = mock.Mock() - method_name = "alarms.get" - action_class = actions.CeilometerAction - action_class.client_method_name = method_name - params = {'alarm_id': '1234-abcd'} - action = action_class(**params) - action.run(mock_ctx) - - self.assertTrue(mocked().alarms.get.called) - mocked().alarms.get.assert_called_once_with(alarm_id="1234-abcd") - @mock.patch.object(actions.TroveAction, '_get_client') def test_trove_action(self, mocked): mock_ctx = mock.Mock() diff --git a/releasenotes/notes/drop-ceilometerclient-b33330a28906759e.yaml b/releasenotes/notes/drop-ceilometerclient-b33330a28906759e.yaml new file mode 100644 index 000000000..b5530eafa --- /dev/null +++ b/releasenotes/notes/drop-ceilometerclient-b33330a28906759e.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Remove ceilometerclient requirement. This library is not maintained + and the ceilometer api is dead. So lets drop this integration. diff --git a/requirements.txt b/requirements.txt index aeda09519..723e7b4a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,7 +31,6 @@ paramiko>=2.0.0 # LGPLv2.1+ pbr!=2.1.0,>=2.0.0 # Apache-2.0 pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 # BSD python-barbicanclient!=4.5.0,!=4.5.1,>=4.0.0 # Apache-2.0 -python-ceilometerclient>=2.5.0 # Apache-2.0 python-cinderclient>=3.3.0 # Apache-2.0 python-designateclient>=2.7.0 # Apache-2.0 python-glanceclient>=2.8.0 # Apache-2.0 diff --git a/tools/get_action_list.py b/tools/get_action_list.py index ed1cd26f9..62c2f5b7c 100644 --- a/tools/get_action_list.py +++ b/tools/get_action_list.py @@ -22,7 +22,6 @@ from aodhclient.v2 import base as aodh_base from aodhclient.v2 import client as aodhclient from barbicanclient import base as barbican_base from barbicanclient import client as barbicanclient -from ceilometerclient.v2 import client as ceilometerclient from cinderclient.apiclient import base as cinder_base from cinderclient.v2 import client as cinderclient from designateclient import client as designateclient @@ -139,11 +138,6 @@ GLANCE_NAMESPACE_LIST = [ 'metadefs_tag', 'metadefs_namespace', 'versions' ] -CEILOMETER_NAMESPACE_LIST = [ - 'alarms', 'capabilities', 'event_types', 'events', 'meters', - 'new_samples', 'query_alarm_history', 'query_alarms', 'query_samples', - 'resources', 'samples', 'statistics', 'trait_descriptions', 'traits' -] DESIGNATE_NAMESPACE_LIST = [ 'diagnostics', 'domains', 'quotas', 'records', 'reports', 'servers', @@ -170,10 +164,6 @@ def get_heat_client(**kwargs): return heatclient.Client('') -def get_ceilometer_client(**kwargs): - return ceilometerclient.Client('') - - def get_cinder_client(**kwargs): return cinderclient.Client() @@ -224,7 +214,6 @@ def get_glare_client(**kwargs): CLIENTS = { 'nova': get_nova_client, 'heat': get_heat_client, - 'ceilometer': get_ceilometer_client, 'cinder': get_cinder_client, 'keystone': get_keystone_client, 'glance': get_glance_client, @@ -246,7 +235,6 @@ CLIENTS = { BASE_MANAGERS = { 'nova': BASE_NOVA_MANAGER, 'heat': BASE_HEAT_MANAGER, - 'ceilometer': None, 'cinder': BASE_CINDER_MANAGER, 'keystone': BASE_KEYSTONE_MANAGER, 'glance': None, @@ -267,7 +255,6 @@ BASE_MANAGERS = { } NAMESPACES = { 'glance': GLANCE_NAMESPACE_LIST, - 'ceilometer': CEILOMETER_NAMESPACE_LIST, 'designate': DESIGNATE_NAMESPACE_LIST, 'glare': GLARE_NAMESPACE_LIST }