summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts/library
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-01-31 15:24:43 -0500
committerGitHub <noreply@github.com>2017-01-31 15:24:43 -0500
commitc5ca64c4c02e5a881960eb275eb1b342582fecee (patch)
tree09f52e245b743e70b4b9eeb9a2fb10c812a35484 /roles/openshift_facts/library
parent5c1d53012537f0479e771df14bf2a05afa768b12 (diff)
parentd7738f38faa12a927e699e01315c6eb8f791d57f (diff)
downloadopenshift-c5ca64c4c02e5a881960eb275eb1b342582fecee.tar.gz
openshift-c5ca64c4c02e5a881960eb275eb1b342582fecee.tar.bz2
openshift-c5ca64c4c02e5a881960eb275eb1b342582fecee.tar.xz
openshift-c5ca64c4c02e5a881960eb275eb1b342582fecee.zip
Merge pull request #3229 from abutcher/node-cert-nodename
Use short instance name as hostname by default in GCE environments
Diffstat (limited to 'roles/openshift_facts/library')
-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']