From d7738f38faa12a927e699e01315c6eb8f791d57f Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Tue, 31 Jan 2017 11:45:53 -0500 Subject: Set default GCE hostname to shost instance name. --- roles/openshift_facts/library/openshift_facts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'roles/openshift_facts/library') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 60c564e5b..7c61da950 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -195,8 +195,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): + hostname.endswith('novalocal')): return False return True @@ -332,7 +331,8 @@ def normalize_gce_facts(metadata, facts): facts['network']['ip'] = facts['network']['interfaces'][0]['ips'][0] pub_ip = facts['network']['interfaces'][0]['public_ips'][0] facts['network']['public_ip'] = pub_ip - facts['network']['hostname'] = metadata['instance']['hostname'] + # Split instance hostname from GCE metadata to use the short instance name + facts['network']['hostname'] = metadata['instance']['hostname'].split('.')[0] # TODO: attempt to resolve public_hostname facts['network']['public_hostname'] = facts['network']['public_ip'] -- cgit v1.2.3