From 45040a56359d3f60103d90a171862e500832f5b4 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 19 Feb 2020 09:44:38 -0500 Subject: [PATCH] Make wait flag optional on flush functions References #72 --- daemon-common/node.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/daemon-common/node.py b/daemon-common/node.py index 8dc96b01..9cf2524e 100644 --- a/daemon-common/node.py +++ b/daemon-common/node.py @@ -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)