summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-04-13 12:27:47 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-04-13 12:27:47 -0400
commit40d95679b7b789e404d39c5642753a1ad2307adf (patch)
treee7c82ce5217796e38b1923e043b6406190632ed4 /roles/openshift_facts
parent9c75f11cf8e71178f0356fafe7f558ec15fe4e15 (diff)
parent79984668190f25310d907fb175f82c875387d30b (diff)
downloadopenshift-40d95679b7b789e404d39c5642753a1ad2307adf.tar.gz
openshift-40d95679b7b789e404d39c5642753a1ad2307adf.tar.bz2
openshift-40d95679b7b789e404d39c5642753a1ad2307adf.tar.xz
openshift-40d95679b7b789e404d39c5642753a1ad2307adf.zip
Merge pull request #1738 from dgoodwin/image-policy-config
Support setting imagePolicyConfig JSON in inventory.
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 2b68f27b7..6de2c1496 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1159,17 +1159,23 @@ def merge_facts(orig, new, additive_facts_to_overwrite, protected_facts_to_overw
protected_facts = ['ha', 'master_count']
# Facts we do not ever want to merge. These originate in inventory variables
- # and typically contain JSON dicts. We don't ever want to trigger a merge
+ # and contain JSON dicts. We don't ever want to trigger a merge
# here, just completely overwrite with the new if they are present there.
- overwrite_facts = ['admission_plugin_config',
- 'kube_admission_plugin_config']
+ inventory_json_facts = ['admission_plugin_config',
+ 'kube_admission_plugin_config',
+ 'image_policy_config']
facts = dict()
for key, value in orig.iteritems():
# Key exists in both old and new facts.
if key in new:
- if key in overwrite_facts:
- facts[key] = copy.deepcopy(new[key])
+ if key in inventory_json_facts:
+ # Watchout for JSON facts that sometimes load as strings.
+ # (can happen if the JSON contains a boolean)
+ if isinstance(new[key], str):
+ facts[key] = yaml.safe_load(new[key])
+ else:
+ facts[key] = copy.deepcopy(new[key])
# Continue to recurse if old and new fact is a dictionary.
elif isinstance(value, dict) and isinstance(new[key], dict):
# Collect the subset of additive facts to overwrite if