Make wait flag optional on flush functions

References #72
This commit is contained in:
Joshua Boniface 2020-02-19 09:44:38 -05:00
parent 097f0d9be4
commit 45040a5635
1 changed files with 2 additions and 4 deletions

View File

@ -143,7 +143,7 @@ def primary_node(zk_conn, node):
return True, retmsg
def flush_node(zk_conn, node, wait):
def flush_node(zk_conn, node, wait=False):
# Verify node is valid
if not common.verifyNode(zk_conn, node):
return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node)
@ -155,7 +155,6 @@ def flush_node(zk_conn, node, wait):
'/nodes/{}/domainstate'.format(node): 'flush'
})
# Wait cannot be triggered from the API
if wait:
while zkhandler.readdata(zk_conn, '/nodes/{}/domainstate'.format(node)) == 'flush':
time.sleep(1)
@ -163,7 +162,7 @@ def flush_node(zk_conn, node, wait):
return True, retmsg
def ready_node(zk_conn, node, wait):
def ready_node(zk_conn, node, wait=False):
# Verify node is valid
if not common.verifyNode(zk_conn, node):
return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node)
@ -175,7 +174,6 @@ def ready_node(zk_conn, node, wait):
'/nodes/{}/domainstate'.format(node): 'unflush'
})
# Wait cannot be triggered from the API
if wait:
while zkhandler.readdata(zk_conn, '/nodes/{}/domainstate'.format(node)) == 'unflush':
time.sleep(1)