Fix properties usage in ResourceChain update
ResourceChain was using the old properties when trying to build the new template in updates. Let's rebuild the properties so that it works properly. Change-Id: I5ba78995819ec2e1d398a02dad9979575bba05b1 Closes-Bug: #1571638
This commit is contained in:
parent
a2fbb93a20
commit
d815a06838
@ -117,6 +117,8 @@ class ResourceChain(stack_resource.StackResource):
|
||||
return self.create_with_template(self.child_template())
|
||||
|
||||
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
||||
self.properties = json_snippet.properties(self.properties_schema,
|
||||
self.context)
|
||||
return self.update_with_template(self.child_template())
|
||||
|
||||
def child_template(self):
|
||||
|
@ -17,6 +17,7 @@ import mock
|
||||
from heat.common.exception import StackValidationFailed
|
||||
from heat.common import grouputils
|
||||
from heat.engine.resources.openstack.heat import resource_chain
|
||||
from heat.engine import rsrc_defn
|
||||
from heat.tests import common
|
||||
from heat.tests import utils
|
||||
|
||||
@ -187,7 +188,11 @@ class ResourceChainTest(common.HeatTestCase):
|
||||
chain = self._create_chain(TEMPLATE)
|
||||
|
||||
# Test
|
||||
chain.handle_update(None, None, None)
|
||||
json_snippet = rsrc_defn.ResourceDefinition(
|
||||
'test-chain', 'OS::Heat::ResourceChain',
|
||||
TEMPLATE['resources']['test-chain']['properties'])
|
||||
|
||||
chain.handle_update(json_snippet, None, None)
|
||||
|
||||
# Verify
|
||||
expected_tmpl = chain.child_template()
|
||||
|
@ -116,6 +116,25 @@ class ResourceChainTests(functional_base.FunctionalTestsBase):
|
||||
found = self.list_resources(nested_id)
|
||||
self.assertEqual(expected, found)
|
||||
|
||||
def test_update_resources(self):
|
||||
params = {'chain-types': 'OS::Heat::None'}
|
||||
|
||||
stack_id = self.stack_create(template=TEMPLATE_PARAM_DRIVEN,
|
||||
parameters=params)
|
||||
|
||||
nested_id = self.group_nested_identifier(stack_id, 'my-chain')
|
||||
expected = {'0': 'OS::Heat::None'}
|
||||
found = self.list_resources(nested_id)
|
||||
self.assertEqual(expected, found)
|
||||
|
||||
params = {'chain-types': 'OS::Heat::None,OS::Heat::None'}
|
||||
self.update_stack(stack_id, template=TEMPLATE_PARAM_DRIVEN,
|
||||
parameters=params)
|
||||
|
||||
expected = {'0': 'OS::Heat::None', '1': 'OS::Heat::None'}
|
||||
found = self.list_resources(nested_id)
|
||||
self.assertEqual(expected, found)
|
||||
|
||||
def test_resources_param_driven(self):
|
||||
# Setup
|
||||
params = {'chain-types':
|
||||
|
Loading…
x
Reference in New Issue
Block a user