From 8307f1e075c69e35d06c10c3034067c7c1801836 Mon Sep 17 00:00:00 2001 From: Pierre Padrixe Date: Tue, 2 Sep 2014 11:36:08 +0200 Subject: [PATCH] Replace marconi by zaqar in heat plugins Change-Id: I9eb68c27e79782f0da0d9a79bf231e09f2f679bc --- contrib/heat_marconi/requirements.txt | 1 - .../{heat_marconi => heat_zaqar}/README.md | 6 ++-- .../heat_zaqar}/__init__.py | 0 .../heat_zaqar}/client.py | 10 +++--- .../heat_zaqar}/resources/__init__.py | 0 .../heat_zaqar}/resources/queue.py | 24 ++++++------- .../heat_zaqar}/tests/__init__.py | 0 .../heat_zaqar}/tests/test_queue.py | 36 +++++++++---------- contrib/heat_zaqar/requirements.txt | 1 + .../{heat_marconi => heat_zaqar}/setup.cfg | 10 +++--- contrib/{heat_marconi => heat_zaqar}/setup.py | 0 11 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 contrib/heat_marconi/requirements.txt rename contrib/{heat_marconi => heat_zaqar}/README.md (68%) rename contrib/{heat_marconi/heat_marconi => heat_zaqar/heat_zaqar}/__init__.py (100%) rename contrib/{heat_marconi/heat_marconi => heat_zaqar/heat_zaqar}/client.py (81%) rename contrib/{heat_marconi/heat_marconi => heat_zaqar/heat_zaqar}/resources/__init__.py (100%) rename contrib/{heat_marconi/heat_marconi => heat_zaqar/heat_zaqar}/resources/queue.py (84%) rename contrib/{heat_marconi/heat_marconi => heat_zaqar/heat_zaqar}/tests/__init__.py (100%) rename contrib/{heat_marconi/heat_marconi => heat_zaqar/heat_zaqar}/tests/test_queue.py (88%) create mode 100644 contrib/heat_zaqar/requirements.txt rename contrib/{heat_marconi => heat_zaqar}/setup.cfg (77%) rename contrib/{heat_marconi => heat_zaqar}/setup.py (100%) diff --git a/contrib/heat_marconi/requirements.txt b/contrib/heat_marconi/requirements.txt deleted file mode 100644 index 0bd5c0f86..000000000 --- a/contrib/heat_marconi/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -python-marconiclient>=0.0.1a1 diff --git a/contrib/heat_marconi/README.md b/contrib/heat_zaqar/README.md similarity index 68% rename from contrib/heat_marconi/README.md rename to contrib/heat_zaqar/README.md index 3d86358f2..fd67db9b3 100644 --- a/contrib/heat_marconi/README.md +++ b/contrib/heat_zaqar/README.md @@ -1,10 +1,10 @@ -Marconi plugin for OpenStack Heat +Zaqar plugin for OpenStack Heat ================================ -This plugin enable using Marconi queuing service as a resource in a Heat template. +This plugin enable using Zaqar queuing service as a resource in a Heat template. -### 1. Install the Marconi plugin in Heat +### 1. Install the Zaqar plugin in Heat NOTE: These instructions assume the value of heat.conf plugin_dirs includes the default directory /usr/lib/heat. diff --git a/contrib/heat_marconi/heat_marconi/__init__.py b/contrib/heat_zaqar/heat_zaqar/__init__.py similarity index 100% rename from contrib/heat_marconi/heat_marconi/__init__.py rename to contrib/heat_zaqar/heat_zaqar/__init__.py diff --git a/contrib/heat_marconi/heat_marconi/client.py b/contrib/heat_zaqar/heat_zaqar/client.py similarity index 81% rename from contrib/heat_marconi/heat_marconi/client.py rename to contrib/heat_zaqar/heat_zaqar/client.py index 64cad5842..94feba3e1 100644 --- a/contrib/heat_marconi/heat_marconi/client.py +++ b/contrib/heat_zaqar/heat_zaqar/client.py @@ -16,20 +16,20 @@ from heat.openstack.common import log as logging LOG = logging.getLogger(__name__) try: - from marconiclient.queues.v1 import client as marconiclient + from zaqarclient.queues.v1 import client as zaqarclient except ImportError: - marconiclient = None + zaqarclient = None from heat.engine.clients import client_plugin -class MarconiClientPlugin(client_plugin.ClientPlugin): +class ZaqarClientPlugin(client_plugin.ClientPlugin): def _create(self): con = self.context if self.auth_token is None: - LOG.error(_("Marconi connection failed, no auth_token!")) + LOG.error(_("Zaqar connection failed, no auth_token!")) return None opts = { @@ -43,6 +43,6 @@ class MarconiClientPlugin(client_plugin.ClientPlugin): conf = {'auth_opts': auth_opts} endpoint = self.url_for(service_type='queuing') - client = marconiclient.Client(url=endpoint, conf=conf) + client = zaqarclient.Client(url=endpoint, conf=conf) return client diff --git a/contrib/heat_marconi/heat_marconi/resources/__init__.py b/contrib/heat_zaqar/heat_zaqar/resources/__init__.py similarity index 100% rename from contrib/heat_marconi/heat_marconi/resources/__init__.py rename to contrib/heat_zaqar/heat_zaqar/resources/__init__.py diff --git a/contrib/heat_marconi/heat_marconi/resources/queue.py b/contrib/heat_zaqar/heat_zaqar/resources/queue.py similarity index 84% rename from contrib/heat_marconi/heat_marconi/resources/queue.py rename to contrib/heat_zaqar/heat_zaqar/resources/queue.py index 93881a138..8a5037411 100644 --- a/contrib/heat_marconi/heat_marconi/resources/queue.py +++ b/contrib/heat_zaqar/heat_zaqar/resources/queue.py @@ -19,14 +19,14 @@ from heat.engine import resource def resource_mapping(): - if not clients.has_client('marconi'): + if not clients.has_client('zaqar'): return {} return { - 'OS::Marconi::Queue': MarconiQueue, + 'OS::Zaqar::Queue': ZaqarQueue, } -class MarconiQueue(resource.Resource): +class ZaqarQueue(resource.Resource): PROPERTIES = ( NAME, METADATA, @@ -62,17 +62,17 @@ class MarconiQueue(resource.Resource): ), } - def marconi(self): - return self.clients.client('marconi') + def zaqar(self): + return self.clients.client('zaqar') def physical_resource_name(self): return self.properties[self.NAME] def handle_create(self): - """Create a marconi message queue.""" + """Create a zaqar message queue.""" queue_name = self.physical_resource_name() - queue = self.marconi().queue(queue_name, auto_create=False) - # Marconi client doesn't report an error if an queue with the same + queue = self.zaqar().queue(queue_name, auto_create=False) + # Zaqar client doesn't report an error if an queue with the same # id/name already exists, which can cause issue with stack update. if queue.exists(): raise exception.Error(_('Message queue %s already exists.') @@ -96,20 +96,20 @@ class MarconiQueue(resource.Resource): def handle_update(self, json_snippet, tmpl_diff, prop_diff): """Update queue metadata.""" if 'metadata' in prop_diff: - queue = self.marconi().queue(self.resource_id, auto_create=False) + queue = self.zaqar().queue(self.resource_id, auto_create=False) metadata = prop_diff['metadata'] queue.metadata(new_meta=metadata) def handle_delete(self): - """Delete a marconi message queue.""" + """Delete a zaqar message queue.""" if not self.resource_id: return - queue = self.marconi().queue(self.resource_id, auto_create=False) + queue = self.zaqar().queue(self.resource_id, auto_create=False) queue.delete() def href(self): - api_endpoint = self.marconi().api_url + api_endpoint = self.zaqar().api_url queue_name = self.physical_resource_name() if api_endpoint.endswith('/'): return '%squeues/%s' % (api_endpoint, queue_name) diff --git a/contrib/heat_marconi/heat_marconi/tests/__init__.py b/contrib/heat_zaqar/heat_zaqar/tests/__init__.py similarity index 100% rename from contrib/heat_marconi/heat_marconi/tests/__init__.py rename to contrib/heat_zaqar/heat_zaqar/tests/__init__.py diff --git a/contrib/heat_marconi/heat_marconi/tests/test_queue.py b/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py similarity index 88% rename from contrib/heat_marconi/heat_marconi/tests/test_queue.py rename to contrib/heat_zaqar/heat_zaqar/tests/test_queue.py index 7d623495e..7fc3e71f6 100644 --- a/contrib/heat_marconi/heat_marconi/tests/test_queue.py +++ b/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py @@ -27,10 +27,10 @@ from ..resources import queue # noqa wp_template = ''' { "AWSTemplateFormatVersion" : "2010-09-09", - "Description" : "openstack Marconi queue service as a resource", + "Description" : "openstack Zaqar queue service as a resource", "Resources" : { "MyQueue2" : { - "Type" : "OS::Marconi::Queue", + "Type" : "OS::Zaqar::Queue", "Properties" : { "name": "myqueue", "metadata": { "key1": { "key2": "value", "key3": [1, 2] } } @@ -70,13 +70,13 @@ class FakeQueue(object): pass -class MarconiMessageQueueTest(HeatTestCase): +class ZaqarMessageQueueTest(HeatTestCase): def setUp(self): - super(MarconiMessageQueueTest, self).setUp() + super(ZaqarMessageQueueTest, self).setUp() self.fc = self.m.CreateMockAnything() self.ctx = utils.dummy_context() - resource._register_class("OS::Marconi::Queue", - queue.MarconiQueue) + resource._register_class("OS::Zaqar::Queue", + queue.ZaqarQueue) def parse_stack(self, t): stack_name = 'test_stack' @@ -90,8 +90,8 @@ class MarconiMessageQueueTest(HeatTestCase): self.parse_stack(t) queue = self.stack['MyQueue2'] - self.m.StubOutWithMock(queue, 'marconi') - queue.marconi().MultipleTimes().AndReturn(self.fc) + self.m.StubOutWithMock(queue, 'zaqar') + queue.zaqar().MultipleTimes().AndReturn(self.fc) fake_q = FakeQueue(queue.physical_resource_name(), auto_create=False) self.m.StubOutWithMock(self.fc, 'queue') @@ -120,8 +120,8 @@ class MarconiMessageQueueTest(HeatTestCase): self.parse_stack(t) queue = self.stack['MyQueue2'] - self.m.StubOutWithMock(queue, 'marconi') - queue.marconi().MultipleTimes().AndReturn(self.fc) + self.m.StubOutWithMock(queue, 'zaqar') + queue.zaqar().MultipleTimes().AndReturn(self.fc) fake_q = FakeQueue("myqueue", auto_create=False) self.m.StubOutWithMock(self.fc, 'queue') @@ -141,8 +141,8 @@ class MarconiMessageQueueTest(HeatTestCase): self.parse_stack(t) queue = self.stack['MyQueue2'] - self.m.StubOutWithMock(queue, 'marconi') - queue.marconi().MultipleTimes().AndReturn(self.fc) + self.m.StubOutWithMock(queue, 'zaqar') + queue.zaqar().MultipleTimes().AndReturn(self.fc) fake_q = FakeQueue("myqueue", auto_create=False) self.m.StubOutWithMock(self.fc, 'queue') @@ -167,8 +167,8 @@ class MarconiMessageQueueTest(HeatTestCase): queue = self.stack['MyQueue2'] queue.resource_id_set(queue.properties.get('name')) - self.m.StubOutWithMock(queue, 'marconi') - queue.marconi().MultipleTimes().AndReturn(self.fc) + self.m.StubOutWithMock(queue, 'zaqar') + queue.zaqar().MultipleTimes().AndReturn(self.fc) fake_q = FakeQueue("myqueue", auto_create=False) self.m.StubOutWithMock(self.fc, 'queue') @@ -188,8 +188,8 @@ class MarconiMessageQueueTest(HeatTestCase): self.parse_stack(t) queue = self.stack['MyQueue2'] queue.resource_id_set(queue.properties.get('name')) - self.m.StubOutWithMock(queue, 'marconi') - queue.marconi().MultipleTimes().AndReturn(self.fc) + self.m.StubOutWithMock(queue, 'zaqar') + queue.zaqar().MultipleTimes().AndReturn(self.fc) fake_q = FakeQueue('myqueue', auto_create=False) self.m.StubOutWithMock(self.fc, 'queue') self.fc.queue('myqueue', @@ -216,8 +216,8 @@ class MarconiMessageQueueTest(HeatTestCase): self.parse_stack(t) queue = self.stack['MyQueue2'] queue.resource_id_set(queue.properties.get('name')) - self.m.StubOutWithMock(queue, 'marconi') - queue.marconi().MultipleTimes().AndReturn(self.fc) + self.m.StubOutWithMock(queue, 'zaqar') + queue.zaqar().MultipleTimes().AndReturn(self.fc) fake_q = FakeQueue('myqueue', auto_create=False) self.m.StubOutWithMock(self.fc, 'queue') self.fc.queue('myqueue', diff --git a/contrib/heat_zaqar/requirements.txt b/contrib/heat_zaqar/requirements.txt new file mode 100644 index 000000000..9c5558e89 --- /dev/null +++ b/contrib/heat_zaqar/requirements.txt @@ -0,0 +1 @@ +python-zaqarclient>=0.0.3 diff --git a/contrib/heat_marconi/setup.cfg b/contrib/heat_zaqar/setup.cfg similarity index 77% rename from contrib/heat_marconi/setup.cfg rename to contrib/heat_zaqar/setup.cfg index 3180f3ed5..35e7e7dea 100644 --- a/contrib/heat_marconi/setup.cfg +++ b/contrib/heat_zaqar/setup.cfg @@ -1,6 +1,6 @@ [metadata] -name = heat-contrib-marconi -summary = Heat resources for working Marconi queues +name = heat-contrib-zaqar +summary = Heat resources for working Zaqar queues description-file = README.md author = OpenStack @@ -19,14 +19,14 @@ classifier = [files] packages = - heat_marconi + heat_zaqar # Copy to /usr/lib/heat for plugin loading data_files = - lib/heat/marconi = heat_marconi/resources/* + lib/heat/zaqar = heat_zaqar/resources/* [entry_points] heat.clients = - marconi = heat_marconi.client:MarconiClientPlugin + zaqar = heat_zaqar.client:ZaqarClientPlugin [global] setup-hooks = diff --git a/contrib/heat_marconi/setup.py b/contrib/heat_zaqar/setup.py similarity index 100% rename from contrib/heat_marconi/setup.py rename to contrib/heat_zaqar/setup.py