From 3d667872314b2d91f64c5ce2bf282a91e6974a9d Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 27 Apr 2016 10:01:02 -0300 Subject: Fix inventory properties with raw booleans, again... The fix earlier in this affected method was only being applied when merging old and new facts. In a first run on a clean system with no pre-existing openshift facts cache, the yaml safe load was not applied resulting in the same broken master config. (which would fix itself if you just reran the config playbook) Apply the same check on new facts not previously applied on the system. --- roles/openshift_facts/library/openshift_facts.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'roles/openshift_facts/library') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index f733fd5a8..be5691b29 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1276,7 +1276,12 @@ def merge_facts(orig, new, additive_facts_to_overwrite, protected_facts_to_overw facts[key] = copy.deepcopy(value) new_keys = set(new.keys()) - set(orig.keys()) for key in new_keys: - facts[key] = copy.deepcopy(new[key]) + # Watchout for JSON facts that sometimes load as strings. + # (can happen if the JSON contains a boolean) + if key in inventory_json_facts and isinstance(new[key], basestring): + facts[key] = yaml.safe_load(new[key]) + else: + facts[key] = copy.deepcopy(new[key]) return facts def save_local_facts(filename, facts): -- cgit v1.2.3