summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts/library/openshift_facts.py
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_facts/library/openshift_facts.py')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 10121f82a..f7506bd63 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1032,6 +1032,8 @@ 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', '')
+ elif 'cloudprovider' in facts and facts['cloudprovider']['kind'] == 'gce':
+ facts['node']['nodename'] = '.'.split(facts['provider']['metadata']['hostname'])[0]
else:
facts['node']['nodename'] = facts['common']['hostname'].lower()
return facts
@@ -1690,9 +1692,38 @@ def set_builddefaults_facts(facts):
if 'admission_plugin_config' not in facts['master']:
facts['master']['admission_plugin_config'] = dict()
facts['master']['admission_plugin_config'].update(builddefaults['config'])
+ # if the user didn't actually provide proxy values, delete the proxy env variable defaults.
+ delete_empty_keys(facts['master']['admission_plugin_config']['BuildDefaults']['configuration']['env'])
+
return facts
+def delete_empty_keys(keylist):
+ """ Delete dictionary elements from keylist where "value" is empty.
+
+ Args:
+ keylist(list): A list of builddefault configuration envs.
+
+ Returns:
+ none
+
+ Example:
+ keylist = [{'name': 'HTTP_PROXY', 'value': 'http://file.rdu.redhat.com:3128'},
+ {'name': 'HTTPS_PROXY', 'value': 'http://file.rdu.redhat.com:3128'},
+ {'name': 'NO_PROXY', 'value': ''}]
+
+ After calling delete_empty_keys the provided list is modified to become:
+
+ [{'name': 'HTTP_PROXY', 'value': 'http://file.rdu.redhat.com:3128'},
+ {'name': 'HTTPS_PROXY', 'value': 'http://file.rdu.redhat.com:3128'}]
+ """
+ count = 0
+ for i in range(0, len(keylist)):
+ if len(keylist[i - count]['value']) == 0:
+ del keylist[i - count]
+ count += 1
+
+
def set_buildoverrides_facts(facts):
""" Set build overrides