2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-16 20:57:53 +00:00

Clear configuration prior to sync

This commit is contained in:
Jarrod Johnson 2018-05-04 12:19:45 -04:00
parent ecfc56efde
commit 5abaddfe63
2 changed files with 15 additions and 0 deletions

View File

@ -59,7 +59,11 @@ def connect_to_leader(cert=None, name=None):
if not ndata:
raise Exception("Error doing initial DB transfer")
dbjson += ndata
cfm.clear_configuration()
cfm._restore_keys(keydata, None)
for c in colldata:
cfm.add_collective_member(c, colldata[c]['address'],
colldata[c]['fingerprint'])
cfm._cfgstore['collective'] = colldata
for globvar in globaldata:
cfm.set_global(globvar, globaldata[globvar])

View File

@ -374,6 +374,17 @@ cfgstreams = {}
def register_config_listener(name, listener):
cfgstreams[listener] = name
def clear_configuration():
global _cfgstore
_cfgstore = {}
todelete = _config_areas + ('globals', 'collective')
for cfg in todelete:
try:
os.remove(os.path.join(ConfigManager._cfgdir, cfg))
except OSError as oe:
pass
def add_collective_member(name, address, fingerprint):
try:
name = name.encode('utf-8')