Use resource_id instead of phy rsrc name in InstanceGroup

Use default resource implementation for get_reference_id in:
* OS::Heat::InstanceGroup
* OS::Heat::AutoScalingGroup
* AWS::AutoScaling::AutoScalingGroup

Story: #2007007
Task: #37870

Change-Id: I7fd223a3bde1c5d2ecd073124a25675567e406d2
This commit is contained in:
ricolin 2020-04-08 16:59:43 +08:00
parent 96c4dbe3ea
commit f8ef790e96
4 changed files with 4 additions and 14 deletions

View File

@ -23,7 +23,6 @@ from heat.engine import constraints
from heat.engine.hot import template
from heat.engine import output
from heat.engine import properties
from heat.engine import resource
from heat.engine.resources.aws.autoscaling import autoscaling_group as aws_asg
from heat.engine import rsrc_defn
from heat.engine import support
@ -208,9 +207,6 @@ class AutoScalingResourceGroup(aws_asg.AutoScalingGroup):
self)._create_template(num_instances, num_replace,
template_version=template_version)
def get_reference_id(self):
return resource.Resource.get_reference_id(self)
def _attribute_output_name(self, *attr_path):
return ', '.join(six.text_type(a) for a in attr_path)

View File

@ -422,9 +422,6 @@ class InstanceGroup(stack_resource.StackResource):
lbs = [self.stack[name] for name in lb_names]
lbutils.reconfigure_loadbalancers(lbs, id_list)
def get_reference_id(self):
return self.physical_resource_name_or_FnGetRefId()
def _group_data(self, refresh=False):
"""Return a cached GroupInspector object for the nested stack."""
if refresh or getattr(self, '_group_inspector', None) is None:

View File

@ -18,7 +18,6 @@ import six
from heat.common import exception
from heat.common import grouputils
from heat.common import short_id
from heat.common import template_format
from heat.engine.clients.os import neutron
from heat.engine import resource
@ -173,12 +172,9 @@ class TestInstanceGroup(common.HeatTestCase):
def test_instance_group_refid_rsrc_name(self):
self.instance_group.id = '123'
self.instance_group.uuid = '9bfb9456-3fe8-41f4-b318-9dba18eeef74'
self.instance_group.action = 'CREATE'
expected = '%s-%s-%s' % (self.instance_group.stack.name,
self.instance_group.name,
short_id.get_id(self.instance_group.uuid))
expected = self.instance_group.name
self.assertEqual(expected, self.instance_group.FnGetRefId())
def test_instance_group_refid_rsrc_id(self):

View File

@ -1,9 +1,10 @@
---
fixes:
- |
The behavior of ``get_resource`` on an ``OS::Heat::AutoScalingGroup``
The behavior of ``get_resource`` on an ``OS::Heat::InstanceGroup``
resource has changed. Previously it returned the physical resource name
(i.e. the name of the nested Heat stack which implemented the group). It
will now return the UUID of the nested stack if available. This will also
apply to any resource type that inherits from
``OS::Heat::AutoScalingGroup``.
``OS::Heat::AutoScalingGroup``, ``OS::Heat::InstanceGroup``, and
``AWS::AutoScaling::AutoScalingGroup``.