Fix incorrect handling of deletions in init
This commit is contained in:
parent
b05c93e260
commit
6adaf1f669
|
@ -267,9 +267,13 @@ def cluster_initialize(zkhandler, overwrite=False):
|
||||||
return False, 'ERROR: Cluster contains data and overwrite not set.'
|
return False, 'ERROR: Cluster contains data and overwrite not set.'
|
||||||
|
|
||||||
if overwrite:
|
if overwrite:
|
||||||
# Delete the existing keys; ignore any errors
|
# Delete the existing keys
|
||||||
status = zkhandler.delete(zkhandler.schema.keys('base'), recursive=True)
|
for key in zkhandler.schema.keys('base'):
|
||||||
|
if key == 'root':
|
||||||
|
# Don't delete the root key
|
||||||
|
continue
|
||||||
|
|
||||||
|
status = zkhandler.delete('base.{}'.format(key), recursive=True)
|
||||||
if not status:
|
if not status:
|
||||||
return False, 'ERROR: Failed to delete data in cluster; running nodes perhaps?'
|
return False, 'ERROR: Failed to delete data in cluster; running nodes perhaps?'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue