Fix attribute caching in Heat AutoScalingGroup
Attributes for an individual resource in an OS::Heat::AutoScalingGroup can be retrieved using the attribute name 'resource.<index>'. Because we were treating the index as a resource name when generating the template, we would never generate an output in the nested template that referenced the resource's attribute, so it wouldn't get cached. Since we can't know the indices ahead of time, the only way to cache these is to do it for all resources in the group - which is the same data cached by the equivalent 'outputs' attribute. We also need to take into account both possible forms of syntax: [<asg_name>, resource.<index>.<attr_name>, ...] or: [<asg_name>, resource.<index>, <attr_name>, ...] Change-Id: I1d2898cdd4759b1bb9de1896a40056685e728f44 Closes-Bug: #1737047 Partial-Bug: #1731349 Related-Bug: #1660831
This commit is contained in:
parent
3ec13d9a8f
commit
4a3a1ad15b
|
@ -230,13 +230,12 @@ class AutoScalingResourceGroup(aws_asg.AutoScalingGroup):
|
|||
|
||||
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)
|
||||
yield output.OutputDefinition(output_name, value)
|
||||
path = keycomponents[2:] + path
|
||||
if path:
|
||||
key = self.OUTPUTS
|
||||
output_name = ', '.join([self.OUTPUTS] + path)
|
||||
|
||||
elif key == self.OUTPUTS and path:
|
||||
if key == self.OUTPUTS and path:
|
||||
value = {r: get_attr_fn([r] + path) for r in resource_names}
|
||||
yield output.OutputDefinition(output_name, value)
|
||||
|
||||
|
|
Loading…
Reference in New Issue