From 02dcfc735741c6bcd18b24737c32afb221dd9e95 Mon Sep 17 00:00:00 2001 From: Liang Chen Date: Sat, 21 Sep 2013 22:55:22 +0800 Subject: [PATCH] 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 --- heat/engine/parser.py | 2 ++ heat/tests/test_parser.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/heat/engine/parser.py b/heat/engine/parser.py index b2e15fd4e..357a5f961 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -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 diff --git a/heat/tests/test_parser.py b/heat/tests/test_parser.py index 552143ead..933639c5e 100644 --- a/heat/tests/test_parser.py +++ b/heat/tests/test_parser.py @@ -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: