Handle PublicIp of None in AutoscalingGroup InstanceList

When the members of an InstanceGroup/AutoscalingGroup are nested stacks
(due to a mapping of AWS::EC2::Instance to a provider template in the
environment), getting the PublicIp attribute will return None instead of
the string '0.0.0.0' that AWS::EC2::Instance returns. Handle this case
without raising an exception.

The AWS AutoscalingGroup's version of the method is removed, since it is
identical to the parent class's.

Change-Id: I398fd985ca5df89d3d3eb145152132a2ec3055eb
This commit is contained in:
Zane Bitter 2017-07-02 22:46:41 -04:00
parent c212573dde
commit 0d93a3e815
2 changed files with 1 additions and 11 deletions

View File

@ -397,16 +397,6 @@ class AutoScalingGroup(cooldown.CooldownMixin, instgrp.InstanceGroup):
super(AutoScalingGroup, self).validate()
def _resolve_attribute(self, name):
"""Resolves the resource's attributes.
heat extension: "InstanceList" returns comma delimited list of server
ip addresses.
"""
if name == self.INSTANCE_LIST:
return u','.join(inst.FnGetAtt('PublicIp')
for inst in grouputils.get_members(self)) or None
def child_template(self):
if self.properties[self.DESIRED_CAPACITY]:
num_instances = self.properties[self.DESIRED_CAPACITY]

View File

@ -397,7 +397,7 @@ class InstanceGroup(stack_resource.StackResource):
ip addresses.
"""
if name == self.INSTANCE_LIST:
return u','.join(inst.FnGetAtt('PublicIp')
return u','.join(inst.FnGetAtt('PublicIp') or '0.0.0.0'
for inst in grouputils.get_members(self)) or None
def _nested_output_defns(self, resource_names, get_attr_fn):