Merge "Allow access to attributes of resumed resources"

This commit is contained in:
Jenkins 2013-09-23 18:03:52 +00:00 committed by Gerrit Code Review
commit 9f6ca49d36
4 changed files with 21 additions and 5 deletions

View File

@ -224,6 +224,8 @@ class HOTemplate(template.Template):
if r.state in ( if r.state in (
(r.CREATE, r.IN_PROGRESS), (r.CREATE, r.IN_PROGRESS),
(r.CREATE, r.COMPLETE), (r.CREATE, r.COMPLETE),
(r.RESUME, r.IN_PROGRESS),
(r.RESUME, r.COMPLETE),
(r.UPDATE, r.IN_PROGRESS), (r.UPDATE, r.IN_PROGRESS),
(r.UPDATE, r.COMPLETE)): (r.UPDATE, r.COMPLETE)):
return r.FnGetAtt(att) return r.FnGetAtt(att)

View File

@ -164,6 +164,8 @@ class Template(collections.Mapping):
if r.state in ( if r.state in (
(r.CREATE, r.IN_PROGRESS), (r.CREATE, r.IN_PROGRESS),
(r.CREATE, r.COMPLETE), (r.CREATE, r.COMPLETE),
(r.RESUME, r.IN_PROGRESS),
(r.RESUME, r.COMPLETE),
(r.UPDATE, r.IN_PROGRESS), (r.UPDATE, r.IN_PROGRESS),
(r.UPDATE, r.COMPLETE)): (r.UPDATE, r.COMPLETE)):
return r.FnGetAtt(att) return r.FnGetAtt(att)

View File

@ -367,9 +367,19 @@ class StackTest(test_parser.StackTest):
(parser.Stack.CREATE, parser.Stack.COMPLETE)) (parser.Stack.CREATE, parser.Stack.COMPLETE))
snippet = {'Value': {'get_attr': ['resource1', 'foo']}} snippet = {'Value': {'get_attr': ['resource1', 'foo']}}
rsrc = self.stack['resource1']
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)
resolved = hot.HOTemplate.resolve_attributes(snippet, self.stack) resolved = hot.HOTemplate.resolve_attributes(snippet, self.stack)
# GenericResourceType has an attribute 'foo' which yields the resource # GenericResourceType has an attribute 'foo' which yields the
# name. # resource name.
self.assertEqual(resolved, {'Value': 'resource1'}) self.assertEqual(resolved, {'Value': 'resource1'})
# test invalid reference # test invalid reference
self.assertRaises(exception.InvalidTemplateAttribute, self.assertRaises(exception.InvalidTemplateAttribute,

View File

@ -1684,6 +1684,8 @@ class StackTest(HeatTestCase):
for action, status in ( for action, status in (
(rsrc.CREATE, rsrc.IN_PROGRESS), (rsrc.CREATE, rsrc.IN_PROGRESS),
(rsrc.CREATE, rsrc.COMPLETE), (rsrc.CREATE, rsrc.COMPLETE),
(rsrc.RESUME, rsrc.IN_PROGRESS),
(rsrc.RESUME, rsrc.COMPLETE),
(rsrc.UPDATE, rsrc.IN_PROGRESS), (rsrc.UPDATE, rsrc.IN_PROGRESS),
(rsrc.UPDATE, rsrc.COMPLETE)): (rsrc.UPDATE, rsrc.COMPLETE)):
rsrc.state_set(action, status) rsrc.state_set(action, status)