Merge "Do not pass rich objects in Zaqar Queue"

This commit is contained in:
Jenkins 2015-04-28 10:56:05 +00:00 committed by Gerrit Code Review
commit a3a8e5b945
2 changed files with 10 additions and 6 deletions

View File

@ -78,17 +78,17 @@ class ZaqarQueue(resource.Resource):
% queue_name) % queue_name)
queue.ensure_exists() queue.ensure_exists()
self.resource_id_set(queue_name) 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.""" """Set metadata of the newly created queue."""
queue = self.client().queue(queue_name, auto_create=False)
if queue.exists(): if queue.exists():
metadata = self.properties.get('metadata') metadata = self.properties.get('metadata')
if metadata: if metadata:
queue.metadata(new_meta=metadata) queue.metadata(new_meta=metadata)
return True return True
else:
queue_name = self.physical_resource_name()
raise exception.Error(_('Message queue %s creation failed.') raise exception.Error(_('Message queue %s creation failed.')
% queue_name) % queue_name)

View File

@ -108,6 +108,8 @@ class ZaqarMessageQueueTest(common.HeatTestCase):
fake_q.exists().AndReturn(False) fake_q.exists().AndReturn(False)
self.m.StubOutWithMock(fake_q, 'ensure_exists') self.m.StubOutWithMock(fake_q, 'ensure_exists')
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) fake_q.exists().AndReturn(True)
self.m.StubOutWithMock(fake_q, 'metadata') self.m.StubOutWithMock(fake_q, 'metadata')
fake_q.metadata(new_meta=queue.properties.get('metadata')) fake_q.metadata(new_meta=queue.properties.get('metadata'))
@ -156,6 +158,8 @@ class ZaqarMessageQueueTest(common.HeatTestCase):
self.m.StubOutWithMock(fake_q, 'exists') self.m.StubOutWithMock(fake_q, 'exists')
fake_q.exists().AndReturn(False) fake_q.exists().AndReturn(False)
self.m.StubOutWithMock(fake_q, 'ensure_exists') 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.ensure_exists()
fake_q.exists().AndReturn(False) fake_q.exists().AndReturn(False)