Get dep_attrs from StackDefinition
Since function.dep_attrs() returns logical resource names (rather than actual objects), we can just as easily use the StackDefinition to calculate it instead of the Stack and Resource objects. In the legacy path, we must ensure we use the StackDefinition from the *new* stack to determine which attributes to include in the NodeData, since that's what we're going to be using it for. In the convergence path the current stack definition already contains the new template. Also, update the *new* stack's definition with the NodeData obtained from completed resources (in addition to the existing stack's), so that that data may be used in calculating the dep_attrs for future resources. This is required when get_attr functions are nested in the template. Change-Id: I23efcc091eae53470f7f9cb3ca21e09f00f43808 Partially-Implements: blueprint stack-definition
This commit is contained in:
parent
47039e2bde
commit
7f72c40f35
|
@ -61,3 +61,41 @@ outputs:
|
|||
stack_identifier, 'resource_output_b')['output']
|
||||
self.assertEqual(expected_output_a, actual_output_a)
|
||||
self.assertEqual(expected_output_b, actual_output_b)
|
||||
|
||||
before_template = '''
|
||||
heat_template_version: 2015-10-15
|
||||
resources:
|
||||
test_resource_a:
|
||||
type: OS::Heat::TestResource
|
||||
properties:
|
||||
value: 'foo'
|
||||
outputs:
|
||||
'''
|
||||
|
||||
after_template = '''
|
||||
heat_template_version: 2015-10-15
|
||||
resources:
|
||||
test_resource_a:
|
||||
type: OS::Heat::TestResource
|
||||
properties:
|
||||
value: 'foo'
|
||||
test_resource_b:
|
||||
type: OS::Heat::TestResource
|
||||
properties:
|
||||
value: {get_attr: [test_resource_a, output]}
|
||||
outputs:
|
||||
output_value:
|
||||
description: 'Output of resource b'
|
||||
value: {get_attr: [test_resource_b, output]}
|
||||
'''
|
||||
|
||||
def test_outputs_update_new_resource(self):
|
||||
stack_identifier = self.stack_create(template=self.before_template)
|
||||
self.update_stack(stack_identifier, template=self.after_template)
|
||||
|
||||
expected_output_value = {
|
||||
u'output_value': u'foo', u'output_key': u'output_value',
|
||||
u'description': u'Output of resource b'}
|
||||
actual_output_value = self.client.stacks.output_show(
|
||||
stack_identifier, 'output_value')['output']
|
||||
self.assertEqual(expected_output_value, actual_output_value)
|
||||
|
|
Loading…
Reference in New Issue