Add and remove dnsaggregator nets on primary change

This commit is contained in:
2018-10-25 21:54:09 -04:00
parent 5740df3a04
commit fd27d3f544
2 changed files with 9 additions and 2 deletions

View File

@ -326,10 +326,13 @@ def cleanup():
# Force into secondary network state if needed
if this_node.name == this_node.primary_node:
zkhandler.writedata(zk_conn, { '/primary_node': 'none' })
zkhandler.writedata(zk_conn, {
'/nodes/{}/routerstate'.format(myhostname): 'secondary',
'/primary_node': 'none'
})
# Wait for things to flush
time.sleep(2)
time.sleep(3)
# Set stop state in Zookeeper
zkhandler.writedata(zk_conn, { '/nodes/{}/daemonstate'.format(myhostname): 'stop' })
@ -344,6 +347,8 @@ def cleanup():
except:
pass
logger.out('Exiting pvc daemon', state='s')
# Handle exit gracefully
atexit.register(cleanup)