diff options
author | Jason DeTiberus <jdetiber@redhat.com> | 2015-05-20 14:00:16 -0400 |
---|---|---|
committer | Jason DeTiberus <jdetiber@redhat.com> | 2015-05-20 14:00:16 -0400 |
commit | 05386153cc68c10c1af78709b576ab35b93dacd3 (patch) | |
tree | 4827541122abd8d1ed9e201c72580879b1ae9f97 | |
parent | 8dedb32348549d8aa279201cfb89c50d5dc83ba5 (diff) | |
download | openshift-05386153cc68c10c1af78709b576ab35b93dacd3.tar.gz openshift-05386153cc68c10c1af78709b576ab35b93dacd3.tar.bz2 openshift-05386153cc68c10c1af78709b576ab35b93dacd3.tar.xz openshift-05386153cc68c10c1af78709b576ab35b93dacd3.zip |
Guard against missing aws metadata for hostnames/ips
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index ec27b5697..9c2657ff2 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -200,7 +200,7 @@ def normalize_aws_facts(metadata, facts): int_info = dict() var_map = {'ips': 'local-ipv4s', 'public_ips': 'public-ipv4s'} for ips_var, int_var in var_map.iteritems(): - ips = interface[int_var] + ips = interface.get(int_var) if isinstance(ips, basestring): int_info[ips_var] = [ips] else: @@ -220,14 +220,14 @@ def normalize_aws_facts(metadata, facts): # TODO: actually attempt to determine default local and public ips # by using the ansible default ip fact and the ipv4-associations # from the ec2 metadata - facts['network']['ip'] = metadata['local-ipv4'] - facts['network']['public_ip'] = metadata['public-ipv4'] + facts['network']['ip'] = metadata.get('local-ipv4') + facts['network']['public_ip'] = metadata.get('public-ipv4') # TODO: verify that local hostname makes sense and is resolvable - facts['network']['hostname'] = metadata['local-hostname'] + facts['network']['hostname'] = metadata.get('local-hostname') # TODO: verify that public hostname makes sense and is resolvable - facts['network']['public_hostname'] = metadata['public-hostname'] + facts['network']['public_hostname'] = metadata.get('public-hostname') return facts |