Allow resource_by_refid returning resumed resources
Resumed resources aren't returned by resource_by_refid, which causes problem after a stack is resumed. Fixes bug #1227032 Change-Id: I87893a04bb267e1b42b55f3c60c22a6268ae4464
This commit is contained in:
parent
6370a8790e
commit
02dcfc7357
@ -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
|
||||
|
@ -967,7 +967,16 @@ class StackTest(HeatTestCase):
|
||||
rsrc = self.stack['AResource']
|
||||
rsrc.resource_id_set('aaaa')
|
||||
self.assertNotEqual(None, resource)
|
||||
self.assertEqual(rsrc, self.stack.resource_by_refid('aaaa'))
|
||||
|
||||
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)
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user