Merge "Allow access to attributes of resumed resources"
This commit is contained in:
commit
9f6ca49d36
@ -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)
|
||||||
|
@ -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)
|
||||||
|
@ -367,11 +367,21 @@ 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']}}
|
||||||
resolved = hot.HOTemplate.resolve_attributes(snippet, self.stack)
|
rsrc = self.stack['resource1']
|
||||||
# GenericResourceType has an attribute 'foo' which yields the resource
|
for action, status in (
|
||||||
# name.
|
(rsrc.CREATE, rsrc.IN_PROGRESS),
|
||||||
self.assertEqual(resolved, {'Value': 'resource1'})
|
(rsrc.CREATE, rsrc.COMPLETE),
|
||||||
# test invalid reference
|
(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)
|
||||||
|
# GenericResourceType has an attribute 'foo' which yields the
|
||||||
|
# resource name.
|
||||||
|
self.assertEqual(resolved, {'Value': 'resource1'})
|
||||||
|
# test invalid reference
|
||||||
self.assertRaises(exception.InvalidTemplateAttribute,
|
self.assertRaises(exception.InvalidTemplateAttribute,
|
||||||
hot.HOTemplate.resolve_attributes,
|
hot.HOTemplate.resolve_attributes,
|
||||||
{'Value': {'get_attr': ['resource1', 'NotThere']}},
|
{'Value': {'get_attr': ['resource1', 'NotThere']}},
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user