diff options
author | Jason DeTiberus <detiber@gmail.com> | 2016-04-27 16:42:26 -0400 |
---|---|---|
committer | Jason DeTiberus <detiber@gmail.com> | 2016-04-27 16:42:26 -0400 |
commit | f1fc354da246f9adfe3e25fba79a72fff0cf7b2e (patch) | |
tree | 1503f55c691cdcdd63fdb2b2d0b23564c3eccca1 | |
parent | 7f67d5dbe872d40afbd00dcaab7f85f41a06910e (diff) | |
parent | 3d667872314b2d91f64c5ce2bf282a91e6974a9d (diff) | |
download | openshift-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-x | roles/openshift_facts/library/openshift_facts.py | 7 |
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): |