Set upstream IP in key if changed

This commit is contained in:
Joshua Boniface 2019-10-21 16:46:32 -04:00
parent 10ae260b92
commit 237a37015d
1 changed files with 9 additions and 0 deletions

View File

@ -936,6 +936,15 @@ if enable_storage:
# Zookeeper keepalive update function # Zookeeper keepalive update function
def update_zookeeper(): def update_zookeeper():
# Set the upstream IP in Zookeeper for clients to read
if config['enable_networking']:
if this_node.router_state == 'primary':
try:
if zkhandler.readdata(zk_conn, '/upstream_ip') != config['upstream_floating_ip']:
raise
except:
zkhandler.writedata(zk_conn, {'/upstream_ip': config['upstream_floating_ip']})
# Get past state and update if needed # Get past state and update if needed
if debug: if debug:
print("Get past state and update if needed") print("Get past state and update if needed")