Fix resource.<n> attribute caching in ResourceGroup/Chain
When generating the nested template output, we need to take into account both forms of syntax: get_attr: [<group_name>, resource.<index>.<attr_name>, ...] or get_attr: [<group_name>, resource.<index>, <attr_name>, ...] Previously we would generate an output for the former case but not the latter, so the attribute wouldn't get cached when that syntax was used. Change-Id: I2a059d5cc42d794ca71caaa1661c32eb76c733fc Closes-Bug: #1742185 Partial-Bug: #1731349 Related-Bug: #1660831
This commit is contained in:
parent
4a3a1ad15b
commit
77112137bb
|
@ -171,9 +171,9 @@ class ResourceChain(stack_resource.StackResource):
|
|||
if key.startswith("resource."):
|
||||
keycomponents = key.split('.', 2)
|
||||
res_name = keycomponents[1]
|
||||
attr_name = keycomponents[2:]
|
||||
if attr_name and (res_name in resource_names):
|
||||
value = get_attr_fn([res_name] + attr_name + path)
|
||||
attr_path = keycomponents[2:] + path
|
||||
if attr_path and (res_name in resource_names):
|
||||
value = get_attr_fn([res_name] + attr_path)
|
||||
yield output.OutputDefinition(output_name, value)
|
||||
|
||||
elif key == self.ATTR_ATTRIBUTES and path:
|
||||
|
|
|
@ -492,9 +492,9 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
if key.startswith("resource."):
|
||||
keycomponents = key.split('.', 2)
|
||||
res_name = keycomponents[1]
|
||||
attr_name = keycomponents[2:]
|
||||
if attr_name and (res_name in resource_names):
|
||||
value = get_attr_fn([res_name] + attr_name + path)
|
||||
attr_path = keycomponents[2:] + path
|
||||
if attr_path and (res_name in resource_names):
|
||||
value = get_attr_fn([res_name] + attr_path)
|
||||
yield output.OutputDefinition(output_name, value)
|
||||
|
||||
elif key == self.ATTR_ATTRIBUTES and path:
|
||||
|
|
Loading…
Reference in New Issue