Move configuration keys to /config tree

This commit is contained in:
2021-06-01 10:40:32 -04:00
parent d6a8cf9780
commit 33a54cf7f2
9 changed files with 67 additions and 32 deletions

View File

@ -46,15 +46,16 @@ def initialize_cluster(zkhandler, overwrite=False):
Initialize a new cluster
"""
# Abort if we've initialized the cluster before
if zkhandler.exists('/primary_node') and not overwrite:
if zkhandler.exists('/config/primary_node') and not overwrite:
return False
if overwrite:
# Delete the existing keys; ignore any errors
status = zkhandler.delete([
'/primary_node',
'/upstream_ip',
'/maintenance',
'/config'
'/config/primary_node',
'/config/upstream_ip',
'/config/maintenance',
'/nodes',
'/domains',
'/networks',
@ -76,9 +77,10 @@ def initialize_cluster(zkhandler, overwrite=False):
# Create the root keys
status = zkhandler.write([
('/primary_node', 'none'),
('/upstream_ip', 'none'),
('/maintenance', 'False'),
('/config', ''),
('/config/primary_node', 'none'),
('/config/upstream_ip', 'none'),
('/config/maintenance', 'False'),
('/nodes', ''),
('/domains', ''),
('/networks', ''),