summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorStefanie Forrester <dak1n1@users.noreply.github.com>2015-09-03 09:24:28 -0700
committerStefanie Forrester <dak1n1@users.noreply.github.com>2015-09-03 09:24:28 -0700
commite45af8287f8118830c2328c9630f6ee4d5776ce8 (patch)
tree4566df220395faa715698437b81dfe6efffa816e /roles/openshift_facts
parent7d480fbab74ddc8f76279f32c1a64148e5844382 (diff)
parent8e3d2689c442762cdd5df08ca31721c5b17b2ee8 (diff)
downloadopenshift-e45af8287f8118830c2328c9630f6ee4d5776ce8.tar.gz
openshift-e45af8287f8118830c2328c9630f6ee4d5776ce8.tar.bz2
openshift-e45af8287f8118830c2328c9630f6ee4d5776ce8.tar.xz
openshift-e45af8287f8118830c2328c9630f6ee4d5776ce8.zip
Merge pull request #522 from dak1n1/master_schedule
added new fact for schedulability and fixed spelling
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index d4f38a7b4..23c74f61c 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -301,6 +301,23 @@ def set_fluentd_facts_if_unset(facts):
facts['common']['use_fluentd'] = use_fluentd
return facts
+def set_node_schedulability(facts):
+ """ Set schedulable facts if not already present in facts dict
+ Args:
+ facts (dict): existing facts
+ Returns:
+ dict: the facts dict updated with the generated schedulable
+ facts if they were not already present
+
+ """
+ if 'node' in facts:
+ if 'schedulable' not in facts['node']:
+ if 'master' in facts:
+ facts['node']['schedulable'] = False
+ else:
+ facts['node']['schedulable'] = True
+ return facts
+
def set_metrics_facts_if_unset(facts):
""" Set cluster metrics facts if not already present in facts dict
dict: the facts dict updated with the generated cluster metrics facts if
@@ -741,6 +758,7 @@ class OpenShiftFacts(object):
facts['current_config'] = get_current_config(facts)
facts = set_url_facts_if_unset(facts)
facts = set_fluentd_facts_if_unset(facts)
+ facts = set_node_schedulability(facts)
facts = set_metrics_facts_if_unset(facts)
facts = set_identity_providers_if_unset(facts)
facts = set_sdn_facts_if_unset(facts)