diff options
author | William Holroyd <wholroyd@users.noreply.github.com> | 2017-03-10 19:08:54 +0100 |
---|---|---|
committer | Sloane Hertel <shertel@redhat.com> | 2017-03-10 19:08:54 +0100 |
commit | 4ca7726e7590972e775408ee99a62cd51f9598a6 (patch) | |
tree | fa2207a6b690b12162c1393ca80995777840a3e4 /contrib | |
parent | Check if file is not a directory with get_bin_path function (#13985) (diff) | |
download | ansible-4ca7726e7590972e775408ee99a62cd51f9598a6.tar.xz ansible-4ca7726e7590972e775408ee99a62cd51f9598a6.zip |
Fix Elasticcache issue where ec2 script would fail on finding lack of primary endpoint address on Redis cluster (#20190)
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/inventory/ec2.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/inventory/ec2.py b/contrib/inventory/ec2.py index de549d29bd..03b9820412 100755 --- a/contrib/inventory/ec2.py +++ b/contrib/inventory/ec2.py @@ -1254,13 +1254,14 @@ class Ec2Inventory(object): if not self.all_elasticache_replication_groups and replication_group['Status'] != 'available': return + # Skip clusters we cannot address (e.g. private VPC subnet or clustered redis) + if replication_group['NodeGroups'][0]['PrimaryEndpoint'] is None or \ + replication_group['NodeGroups'][0]['PrimaryEndpoint']['Address'] is None: + return + # Select the best destination address (PrimaryEndpoint) dest = replication_group['NodeGroups'][0]['PrimaryEndpoint']['Address'] - if not dest: - # Skip clusters we cannot address (e.g. private VPC subnet) - return - # Add to index self.index[dest] = [region, replication_group['ReplicationGroupId']] |