diff --git a/contrib/heat_zaqar/heat_zaqar/resources/queue.py b/contrib/heat_zaqar/heat_zaqar/resources/queue.py index 3d743a469d..b46508f617 100644 --- a/contrib/heat_zaqar/heat_zaqar/resources/queue.py +++ b/contrib/heat_zaqar/heat_zaqar/resources/queue.py @@ -78,19 +78,19 @@ class ZaqarQueue(resource.Resource): % queue_name) queue.ensure_exists() self.resource_id_set(queue_name) - return queue + return queue_name - def check_create_complete(self, queue): + def check_create_complete(self, queue_name): """Set metadata of the newly created queue.""" + queue = self.client().queue(queue_name, auto_create=False) if queue.exists(): metadata = self.properties.get('metadata') if metadata: queue.metadata(new_meta=metadata) return True - - queue_name = self.physical_resource_name() - raise exception.Error(_('Message queue %s creation failed.') - % queue_name) + else: + raise exception.Error(_('Message queue %s creation failed.') + % queue_name) def handle_update(self, json_snippet, tmpl_diff, prop_diff): """Update queue metadata.""" diff --git a/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py b/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py index 7875df09b3..8551df3988 100644 --- a/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py +++ b/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py @@ -108,6 +108,8 @@ class ZaqarMessageQueueTest(common.HeatTestCase): fake_q.exists().AndReturn(False) self.m.StubOutWithMock(fake_q, 'ensure_exists') fake_q.ensure_exists() + self.fc.queue(queue.physical_resource_name(), + auto_create=False).AndReturn(fake_q) fake_q.exists().AndReturn(True) self.m.StubOutWithMock(fake_q, 'metadata') fake_q.metadata(new_meta=queue.properties.get('metadata')) @@ -156,6 +158,8 @@ class ZaqarMessageQueueTest(common.HeatTestCase): self.m.StubOutWithMock(fake_q, 'exists') fake_q.exists().AndReturn(False) self.m.StubOutWithMock(fake_q, 'ensure_exists') + self.fc.queue(queue.physical_resource_name(), + auto_create=False).AndReturn(fake_q) fake_q.ensure_exists() fake_q.exists().AndReturn(False)