summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2017-01-31 11:45:53 -0500
committerAndrew Butcher <abutcher@redhat.com>2017-01-31 13:55:08 -0500
commitd7738f38faa12a927e699e01315c6eb8f791d57f (patch)
treefca3d04dd231468590610c04421e3846ca7736ac /roles
parentfca215887b2e4224779b58e8fd1b7662ec993f83 (diff)
downloadopenshift-d7738f38faa12a927e699e01315c6eb8f791d57f.tar.gz
openshift-d7738f38faa12a927e699e01315c6eb8f791d57f.tar.bz2
openshift-d7738f38faa12a927e699e01315c6eb8f791d57f.tar.xz
openshift-d7738f38faa12a927e699e01315c6eb8f791d57f.zip
Set default GCE hostname to shost instance name.
Diffstat (limited to 'roles')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py6
1 files changed, 3 insertions, 3 deletions
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']