summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason DeTiberus <detiber@gmail.com>2016-04-27 16:42:26 -0400
committerJason DeTiberus <detiber@gmail.com>2016-04-27 16:42:26 -0400
commitf1fc354da246f9adfe3e25fba79a72fff0cf7b2e (patch)
tree1503f55c691cdcdd63fdb2b2d0b23564c3eccca1
parent7f67d5dbe872d40afbd00dcaab7f85f41a06910e (diff)
parent3d667872314b2d91f64c5ce2bf282a91e6974a9d (diff)
downloadopenshift-f1fc354da246f9adfe3e25fba79a72fff0cf7b2e.tar.gz
openshift-f1fc354da246f9adfe3e25fba79a72fff0cf7b2e.tar.bz2
openshift-f1fc354da246f9adfe3e25fba79a72fff0cf7b2e.tar.xz
openshift-f1fc354da246f9adfe3e25fba79a72fff0cf7b2e.zip
Merge pull request #1818 from dgoodwin/safe-yaml-3
Fix inventory properties with raw booleans, again...
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 8d7f12bc8..6697e29e1 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):