diff options
author | Stefanie Forrester <sedgar@redhat.com> | 2015-08-27 12:45:06 -0700 |
---|---|---|
committer | Stefanie Forrester <sedgar@redhat.com> | 2015-09-02 16:20:41 -0700 |
commit | 8e3d2689c442762cdd5df08ca31721c5b17b2ee8 (patch) | |
tree | 4566df220395faa715698437b81dfe6efffa816e /roles/openshift_facts/library | |
parent | 7d480fbab74ddc8f76279f32c1a64148e5844382 (diff) | |
download | openshift-8e3d2689c442762cdd5df08ca31721c5b17b2ee8.tar.gz openshift-8e3d2689c442762cdd5df08ca31721c5b17b2ee8.tar.bz2 openshift-8e3d2689c442762cdd5df08ca31721c5b17b2ee8.tar.xz openshift-8e3d2689c442762cdd5df08ca31721c5b17b2ee8.zip |
added new node fact for schedulability
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 18 |
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) |