Make 'refs' attribute of ResourceGroup resource indexable
With this change 'refs' attribute of the ResourceGroup resource will support indexing. Change-Id: I7715897091a55ed333e4b07bd1ad38bd4d8aa019 Closes-Bug: #1434586
This commit is contained in:
parent
4b855ef5cc
commit
553727cfd0
|
@ -264,7 +264,8 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
|
||||
names = self._resource_names()
|
||||
if key == self.REFS:
|
||||
return [grouputils.get_rsrc_id(self, key, False, n) for n in names]
|
||||
vals = [grouputils.get_rsrc_id(self, key, False, n) for n in names]
|
||||
return attributes.select_from_attribute(vals, path)
|
||||
if key == self.ATTR_ATTRIBUTES:
|
||||
if not path:
|
||||
raise exception.InvalidTemplateAttribute(
|
||||
|
|
|
@ -568,6 +568,16 @@ class ResourceGroupAttrTest(common.HeatTestCase):
|
|||
expected = ['ID-0', 'ID-1']
|
||||
self.assertEqual(expected, resg.FnGetAtt("refs"))
|
||||
|
||||
def test_aggregate_refs_with_index(self):
|
||||
"""
|
||||
Test resource id aggregation with index
|
||||
"""
|
||||
resg = self._create_dummy_stack()
|
||||
expected = ['ID-0', 'ID-1']
|
||||
self.assertEqual(expected[0], resg.FnGetAtt("refs", 0))
|
||||
self.assertEqual(expected[1], resg.FnGetAtt("refs", 1))
|
||||
self.assertIsNone(resg.FnGetAtt("refs", 2))
|
||||
|
||||
def test_aggregate_outputs(self):
|
||||
"""
|
||||
Test outputs aggregation
|
||||
|
|
Loading…
Reference in New Issue