diff options
author | Wesley Hearn <wesley.s.hearn@gmail.com> | 2015-05-21 11:30:40 -0400 |
---|---|---|
committer | Wesley Hearn <wesley.s.hearn@gmail.com> | 2015-05-21 11:30:40 -0400 |
commit | 7294ef1e8dac81cc438dcfc8be3686bf0115f4e3 (patch) | |
tree | d7f7dfe85373728f77437abf103ae87ab2dc5c4a | |
parent | 83f1103c062bc0e4681f9087274a0840c9430220 (diff) | |
parent | 05386153cc68c10c1af78709b576ab35b93dacd3 (diff) | |
download | openshift-7294ef1e8dac81cc438dcfc8be3686bf0115f4e3.tar.gz openshift-7294ef1e8dac81cc438dcfc8be3686bf0115f4e3.tar.bz2 openshift-7294ef1e8dac81cc438dcfc8be3686bf0115f4e3.tar.xz openshift-7294ef1e8dac81cc438dcfc8be3686bf0115f4e3.zip |
Merge pull request #235 from detiber/awsNoPublic
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 |