diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2016-04-27 10:01:02 -0300 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2016-04-27 10:01:02 -0300 |
commit | 3d667872314b2d91f64c5ce2bf282a91e6974a9d (patch) | |
tree | c79aae430a3b0ca16287c46bb73aed676b7d3a55 /roles/openshift_facts/library | |
parent | 207b5aea8d619acb9622a351f54301c24598b08d (diff) | |
download | openshift-3d667872314b2d91f64c5ce2bf282a91e6974a9d.tar.gz openshift-3d667872314b2d91f64c5ce2bf282a91e6974a9d.tar.bz2 openshift-3d667872314b2d91f64c5ce2bf282a91e6974a9d.tar.xz openshift-3d667872314b2d91f64c5ce2bf282a91e6974a9d.zip |
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.
Diffstat (limited to 'roles/openshift_facts/library')
-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 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): |