Merge "Allow resource_by_refid returning resumed resources"

This commit is contained in:
Jenkins 2013-09-23 18:42:45 +00:00 committed by Gerrit Code Review
commit cf38339328
2 changed files with 12 additions and 1 deletions

View File

@ -260,6 +260,8 @@ class Stack(object):
if r.state in (
(r.CREATE, r.IN_PROGRESS),
(r.CREATE, r.COMPLETE),
(r.RESUME, r.IN_PROGRESS),
(r.RESUME, r.COMPLETE),
(r.UPDATE, r.IN_PROGRESS),
(r.UPDATE, r.COMPLETE)) and r.FnGetRefId() == refid:
return r

View File

@ -967,6 +967,15 @@ class StackTest(HeatTestCase):
rsrc = self.stack['AResource']
rsrc.resource_id_set('aaaa')
self.assertNotEqual(None, resource)
for action, status in (
(rsrc.CREATE, rsrc.IN_PROGRESS),
(rsrc.CREATE, rsrc.COMPLETE),
(rsrc.RESUME, rsrc.IN_PROGRESS),
(rsrc.RESUME, rsrc.COMPLETE),
(rsrc.UPDATE, rsrc.IN_PROGRESS),
(rsrc.UPDATE, rsrc.COMPLETE)):
rsrc.state_set(action, status)
self.assertEqual(rsrc, self.stack.resource_by_refid('aaaa'))
rsrc.state_set(rsrc.DELETE, rsrc.IN_PROGRESS)