浏览代码

Pop etcd_port from local_facts file

Some variables are hanging around in openshift.facts
fact file on hosts that shouldn't be.

This causes old versions of defaults to take precedence
over new default values in openshift_facts.

This commit pops master.etcd_port from the facts being
saved to disk.  This allows the correct default port
for etcd to take effect.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1546365
Michael Gugino 7 年之前
父节点
当前提交
a255b3976b
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      roles/openshift_facts/library/openshift_facts.py

+ 12 - 0
roles/openshift_facts/library/openshift_facts.py

@@ -1066,6 +1066,17 @@ def set_container_facts_if_unset(facts):
     return facts
 
 
+def pop_obsolete_local_facts(local_facts):
+    """Remove unused keys from local_facts"""
+    keys_to_remove = {
+        'master': ('etcd_port',)
+    }
+    for role in keys_to_remove:
+        if role in local_facts:
+            for key in keys_to_remove[role]:
+                local_facts[role].pop(key, None)
+
+
 class OpenShiftFactsInternalError(Exception):
     """Origin Facts Error"""
     pass
@@ -1330,6 +1341,7 @@ class OpenShiftFacts(object):
                                       additive_facts_to_overwrite)
 
         new_local_facts = self.remove_empty_facts(new_local_facts)
+        pop_obsolete_local_facts(new_local_facts)
 
         if new_local_facts != local_facts:
             self.validate_local_facts(new_local_facts)