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
(cherry picked from commit 77112137bb
)
This commit is contained in:
parent
cda1cf15f4
commit
e94e90b4f2
|
@ -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:
|
||||
|
|
|
@ -467,9 +467,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