summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-04-20 11:59:56 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-04-20 11:59:56 -0400
commitfd2eef29ab0b34ee55920b25226d570bd0501ed0 (patch)
tree4f69c03d745f56375b506531adf40b37fa9b880a /roles/openshift_facts
parentc64590a63e64c6edad86766fbac5bf00b176b7c4 (diff)
parentbfa45e45ed906c4a83ce985ad5f4375fde950178 (diff)
downloadopenshift-fd2eef29ab0b34ee55920b25226d570bd0501ed0.tar.gz
openshift-fd2eef29ab0b34ee55920b25226d570bd0501ed0.tar.bz2
openshift-fd2eef29ab0b34ee55920b25226d570bd0501ed0.tar.xz
openshift-fd2eef29ab0b34ee55920b25226d570bd0501ed0.zip
Merge pull request #1766 from abutcher/router-selector
Bug 1328119 - router selector not obeyed
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 862871bd8..f2d17293a 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -95,6 +95,7 @@ def migrate_local_facts(facts):
migrated_facts = migrate_docker_facts(migrated_facts)
migrated_facts = migrate_common_facts(migrated_facts)
migrated_facts = migrate_node_facts(migrated_facts)
+ migrated_facts = migrate_hosted_facts(migrated_facts)
return migrated_facts
def migrate_hosted_facts(facts):
@@ -1852,14 +1853,7 @@ class OpenShiftFacts(object):
val = [x.strip() for x in val.split(',')]
new_local_facts['docker'][key] = list(set(val) - set(['']))
- for facts in new_local_facts.values():
- keys_to_delete = []
- if isinstance(facts, dict):
- for fact, value in facts.iteritems():
- if value == "" or value is None:
- keys_to_delete.append(fact)
- for key in keys_to_delete:
- del facts[key]
+ new_local_facts = self.remove_empty_facts(new_local_facts)
if new_local_facts != local_facts:
self.validate_local_facts(new_local_facts)
@@ -1870,6 +1864,23 @@ class OpenShiftFacts(object):
self.changed = changed
return new_local_facts
+ def remove_empty_facts(self, facts=None):
+ """ Remove empty facts
+
+ Args:
+ facts (dict): facts to clean
+ """
+ facts_to_remove = []
+ for fact, value in facts.iteritems():
+ if isinstance(facts[fact], dict):
+ facts[fact] = self.remove_empty_facts(facts[fact])
+ else:
+ if value == "" or value is None:
+ facts_to_remove.append(fact)
+ for fact in facts_to_remove:
+ del facts[fact]
+ return facts
+
def validate_local_facts(self, facts=None):
""" Validate local facts