From ab584e500e08f2f22e120e327908ecee9536719d Mon Sep 17 00:00:00 2001 From: Ifat Afek Date: Wed, 20 Feb 2019 17:48:36 +0000 Subject: [PATCH] Added a Vitrage client Story: 2002684 Task: 23116 Change-Id: If05f0907d8f43f64327c7774170e5b559286fc06 --- README.rst | 1 + heat/common/config.py | 2 +- heat/engine/clients/os/vitrage.py | 30 +++++++++++++++++++ heat/tests/clients/test_vitrage_client.py | 24 +++++++++++++++ lower-constraints.txt | 1 + ...itrage-client-plugin-cb9e6b51ec2cc6ec.yaml | 4 +++ requirements.txt | 1 + setup.cfg | 1 + 8 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 heat/engine/clients/os/vitrage.py create mode 100644 heat/tests/clients/test_vitrage_client.py create mode 100644 releasenotes/notes/add-vitrage-client-plugin-cb9e6b51ec2cc6ec.yaml diff --git a/README.rst b/README.rst index b3a646dcac..10ec06dff7 100644 --- a/README.rst +++ b/README.rst @@ -75,3 +75,4 @@ We have integration with * https://opendev.org/openstack/python-blazarclient (reservation service) * https://opendev.org/openstack/python-octaviaclient.git (Load-balancer service) * https://opendev.org/openstack/python-senlinclient (Clustering service) +* https://opendev.org/openstack/python-vitrageclient.git (RCA service) diff --git a/heat/common/config.py b/heat/common/config.py index 92140824c2..252e0d54ad 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -448,7 +448,7 @@ def list_opts(): for client in ('aodh', 'barbican', 'cinder', 'designate', 'glance', 'heat', 'keystone', 'magnum', 'manila', 'mistral', 'monasca', 'neutron', 'nova', 'octavia', 'sahara', 'senlin', - 'swift', 'trove', 'zaqar' + 'swift', 'trove', 'vitrage', 'zaqar' ): client_specific_group = 'clients_' + client yield client_specific_group, clients_opts diff --git a/heat/engine/clients/os/vitrage.py b/heat/engine/clients/os/vitrage.py new file mode 100644 index 0000000000..c51b5f2f26 --- /dev/null +++ b/heat/engine/clients/os/vitrage.py @@ -0,0 +1,30 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from heat.engine.clients import client_plugin +from oslo_log import log as logging +from vitrageclient import client as vitrage_client + +LOG = logging.getLogger(__name__) + +CLIENT_NAME = 'vitrage' + + +class VitrageClientPlugin(client_plugin.ClientPlugin): + + exceptions_module = None + + service_types = [RCA] = ['rca'] + + def _create(self): + return vitrage_client.Client('1', self.context.keystone_session) diff --git a/heat/tests/clients/test_vitrage_client.py b/heat/tests/clients/test_vitrage_client.py new file mode 100644 index 0000000000..8e9c46b075 --- /dev/null +++ b/heat/tests/clients/test_vitrage_client.py @@ -0,0 +1,24 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from heat.tests import common +from heat.tests import utils + + +class VitrageClientPluginTest(common.HeatTestCase): + + def test_create(self): + context = utils.dummy_context() + plugin = context.clients.client_plugin('vitrage') + client = plugin.client() + self.assertIsNotNone(client.template.list) diff --git a/lower-constraints.txt b/lower-constraints.txt index b0678d3db9..8fdc81b18f 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -124,6 +124,7 @@ python-saharaclient==1.4.0 python-subunit==1.2.0 python-swiftclient==3.2.0 python-troveclient==2.2.0 +python-vitrageclient==2.7.0 python-zaqarclient==1.3.0 python-zunclient==3.4.0 pytz==2013.6 diff --git a/releasenotes/notes/add-vitrage-client-plugin-cb9e6b51ec2cc6ec.yaml b/releasenotes/notes/add-vitrage-client-plugin-cb9e6b51ec2cc6ec.yaml new file mode 100644 index 0000000000..e86394e811 --- /dev/null +++ b/releasenotes/notes/add-vitrage-client-plugin-cb9e6b51ec2cc6ec.yaml @@ -0,0 +1,4 @@ +--- +features: + - Introduce a Vitrage client plugin module that will be used by the + Vitrage resources. diff --git a/requirements.txt b/requirements.txt index 656bfaca27..e0109c9d40 100644 --- a/requirements.txt +++ b/requirements.txt @@ -50,6 +50,7 @@ python-openstackclient>=3.12.0 # Apache-2.0 python-saharaclient>=1.4.0 # Apache-2.0 python-swiftclient>=3.2.0 # Apache-2.0 python-troveclient>=2.2.0 # Apache-2.0 +python-vitrageclient>=2.7.0 # Apache-2.0 python-zaqarclient>=1.3.0 # Apache-2.0 python-zunclient>=3.4.0 # Apache-2.0 pytz>=2013.6 # MIT diff --git a/setup.cfg b/setup.cfg index c8bb011db3..8301eab12a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -86,6 +86,7 @@ heat.clients = senlin = heat.engine.clients.os.senlin:SenlinClientPlugin swift = heat.engine.clients.os.swift:SwiftClientPlugin trove = heat.engine.clients.os.trove:TroveClientPlugin + vitrage = heat.engine.clients.os.vitrage:VitrageClientPlugin zaqar = heat.engine.clients.os.zaqar:ZaqarClientPlugin zun = heat.engine.clients.os.zun:ZunClientPlugin