diff options
author | Andrew Butcher <abutcher@afrolegs.com> | 2016-09-26 14:20:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-26 14:20:13 -0400 |
commit | f7ba21be241e9a3f3354b44332611fe5095fc57f (patch) | |
tree | 4f981163b3b792d2af3de610e66f4eac2a65f1f9 /roles/openshift_facts/library | |
parent | b7aaf7bd860625a1dc929a2397c28c3e33aab94f (diff) | |
parent | 1f2276fff1e41c1d9440ee8b589042ee249b95d7 (diff) | |
download | openshift-f7ba21be241e9a3f3354b44332611fe5095fc57f.tar.gz openshift-f7ba21be241e9a3f3354b44332611fe5095fc57f.tar.bz2 openshift-f7ba21be241e9a3f3354b44332611fe5095fc57f.tar.xz openshift-f7ba21be241e9a3f3354b44332611fe5095fc57f.zip |
Merge pull request #2501 from lhuard1A/fix_openstack_cloudprovider
Fix openstack cloudprovider
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index b2d007ec9..e94cb0952 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -149,6 +149,7 @@ def hostname_valid(hostname): if (not hostname or hostname.startswith('localhost') or hostname.endswith('localdomain') or + hostname.endswith('novalocal') or len(hostname.split('.')) < 2): return False @@ -918,6 +919,14 @@ def set_sdn_facts_if_unset(facts, system_facts): return facts +def set_nodename(facts): + if 'node' in facts and 'common' in facts: + if 'cloudprovider' in facts and facts['cloudprovider']['kind'] == 'openstack': + facts['node']['nodename'] = facts['provider']['metadata']['hostname'].replace('.novalocal', '') + else: + facts['node']['nodename'] = facts['common']['hostname'].lower() + return facts + def migrate_oauth_template_facts(facts): """ Migrate an old oauth template fact to a newer format if it's present. @@ -1220,7 +1229,7 @@ def apply_provider_facts(facts, provider_facts): facts['common'][h_var] = choose_hostname( [provider_facts['network'].get(h_var)], - facts['common'][ip_var] + facts['common'][h_var] ) facts['provider'] = provider_facts @@ -1701,6 +1710,7 @@ class OpenShiftFacts(object): facts = set_proxy_facts(facts) if not safe_get_bool(facts['common']['is_containerized']): facts = set_installed_variant_rpm_facts(facts) + facts = set_nodename(facts) return dict(openshift=facts) def get_defaults(self, roles, deployment_type, deployment_subtype): |