summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2016-02-15 14:52:45 -0500
committerAndrew Butcher <abutcher@redhat.com>2016-02-16 15:14:45 -0500
commit9f22f2654dac464ab419867e27d0ed6155a2a356 (patch)
treeb2c536ef694ffb50a5964e1869240bb87fc21fab /roles/openshift_facts
parentcafecf3e0d9b973f43fb9a83b5e3bc8700ee16cb (diff)
downloadopenshift-9f22f2654dac464ab419867e27d0ed6155a2a356.tar.gz
openshift-9f22f2654dac464ab419867e27d0ed6155a2a356.tar.bz2
openshift-9f22f2654dac464ab419867e27d0ed6155a2a356.tar.xz
openshift-9f22f2654dac464ab419867e27d0ed6155a2a356.zip
Fail when master.master_count descreases or master.ha changes.
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 360033c32..b6edd8e2f 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -972,14 +972,18 @@ def merge_facts(orig, new, additive_facts_to_overwrite, protected_facts_to_overw
elif key in protected_facts and key not in [x.split('.')[-1] for x in protected_facts_to_overwrite]:
# The master count (int) can only increase unless it
# has been passed as a protected fact to overwrite.
- if key == 'master_count' and int(value) <= int(new[key]):
- facts[key] = copy.deepcopy(new[key])
- else:
- facts[key] = value
+ if key == 'master_count':
+ if int(value) <= int(new[key]):
+ facts[key] = copy.deepcopy(new[key])
+ else:
+ module.fail_json(msg='openshift_facts received a lower value for openshift.master.master_count')
# ha (bool) can not change unless it has been passed
# as a protected fact to overwrite.
if key == 'ha':
- facts[key] = value
+ if bool(value) != bool(new[key]):
+ module.fail_json(msg='openshift_facts received a different value for openshift.master.ha')
+ else:
+ facts[key] = value
# No other condition has been met. Overwrite the old fact
# with the new value.
else: