Merge "Fix nested template genearation when attribute path is not string" into stable/pike
This commit is contained in:
commit
cda1cf15f4
|
@ -226,7 +226,7 @@ class AutoScalingResourceGroup(aws_asg.AutoScalingGroup):
|
||||||
output_name = attr
|
output_name = attr
|
||||||
else:
|
else:
|
||||||
key, path = attr[0], list(attr[1:])
|
key, path = attr[0], list(attr[1:])
|
||||||
output_name = ', '.join(attr)
|
output_name = ', '.join(six.text_type(a) for a in attr)
|
||||||
|
|
||||||
if key.startswith("resource."):
|
if key.startswith("resource."):
|
||||||
keycomponents = key.split('.', 2)
|
keycomponents = key.split('.', 2)
|
||||||
|
|
|
@ -166,7 +166,7 @@ class ResourceChain(stack_resource.StackResource):
|
||||||
output_name = attr
|
output_name = attr
|
||||||
else:
|
else:
|
||||||
key, path = attr[0], list(attr[1:])
|
key, path = attr[0], list(attr[1:])
|
||||||
output_name = ', '.join(attr)
|
output_name = ', '.join(six.text_type(a) for a in attr)
|
||||||
|
|
||||||
if key.startswith("resource."):
|
if key.startswith("resource."):
|
||||||
keycomponents = key.split('.', 2)
|
keycomponents = key.split('.', 2)
|
||||||
|
|
|
@ -462,7 +462,7 @@ class ResourceGroup(stack_resource.StackResource):
|
||||||
output_name = attr
|
output_name = attr
|
||||||
else:
|
else:
|
||||||
key, path = attr[0], list(attr[1:])
|
key, path = attr[0], list(attr[1:])
|
||||||
output_name = ', '.join(attr)
|
output_name = ', '.join(six.text_type(a) for a in attr)
|
||||||
|
|
||||||
if key.startswith("resource."):
|
if key.startswith("resource."):
|
||||||
keycomponents = key.split('.', 2)
|
keycomponents = key.split('.', 2)
|
||||||
|
|
|
@ -42,6 +42,13 @@ class TestAutoScalingGroupValidation(common.HeatTestCase):
|
||||||
self.assertRaises(exception.StackValidationFailed,
|
self.assertRaises(exception.StackValidationFailed,
|
||||||
stack['my-group'].validate)
|
stack['my-group'].validate)
|
||||||
|
|
||||||
|
def test_validate_reference_attr_with_none_ref(self):
|
||||||
|
stack = utils.parse_stack(self.parsed)
|
||||||
|
group = stack['my-group']
|
||||||
|
self.patchobject(group, 'referenced_attrs',
|
||||||
|
return_value=set([('something', None)]))
|
||||||
|
self.assertIsNone(group.validate())
|
||||||
|
|
||||||
|
|
||||||
class TestScalingGroupTags(common.HeatTestCase):
|
class TestScalingGroupTags(common.HeatTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -129,6 +129,12 @@ class ResourceChainTest(common.HeatTestCase):
|
||||||
chain = self._create_chain(TEMPLATE)
|
chain = self._create_chain(TEMPLATE)
|
||||||
chain.validate_nested_stack()
|
chain.validate_nested_stack()
|
||||||
|
|
||||||
|
def test_validate_reference_attr_with_none_ref(self):
|
||||||
|
chain = self._create_chain(TEMPLATE)
|
||||||
|
self.patchobject(chain, 'referenced_attrs',
|
||||||
|
return_value=set([('config', None)]))
|
||||||
|
self.assertIsNone(chain.validate())
|
||||||
|
|
||||||
def test_validate_incompatible_properties(self):
|
def test_validate_incompatible_properties(self):
|
||||||
# Tests a resource in the chain that does not support the properties
|
# Tests a resource in the chain that does not support the properties
|
||||||
# specified to each resource.
|
# specified to each resource.
|
||||||
|
|
|
@ -507,6 +507,14 @@ class ResourceGroupTest(common.HeatTestCase):
|
||||||
resgrp = resource_group.ResourceGroup('test', snip, stack)
|
resgrp = resource_group.ResourceGroup('test', snip, stack)
|
||||||
self.assertIsNone(resgrp.validate())
|
self.assertIsNone(resgrp.validate())
|
||||||
|
|
||||||
|
def test_validate_reference_attr_with_none_ref(self):
|
||||||
|
stack = utils.parse_stack(template_attr)
|
||||||
|
snip = stack.t.resource_definitions(stack)['group1']
|
||||||
|
resgrp = resource_group.ResourceGroup('test', snip, stack)
|
||||||
|
self.patchobject(resgrp, 'referenced_attrs',
|
||||||
|
return_value=set([('nested_dict', None)]))
|
||||||
|
self.assertIsNone(resgrp.validate())
|
||||||
|
|
||||||
def test_invalid_removal_policies_nolist(self):
|
def test_invalid_removal_policies_nolist(self):
|
||||||
"""Test that error raised for malformed removal_policies."""
|
"""Test that error raised for malformed removal_policies."""
|
||||||
tmp = copy.deepcopy(template)
|
tmp = copy.deepcopy(template)
|
||||||
|
|
Loading…
Reference in New Issue