Revert "Implement wait for node coordinator transition"
This reverts commit 0aefafa7f7
.
This does not work since the API goes away during the transition.
References #72
This commit is contained in:
@ -89,7 +89,7 @@ def getNodeInformation(zk_conn, node_name):
|
||||
#
|
||||
# Direct Functions
|
||||
#
|
||||
def secondary_node(zk_conn, node, wait=False):
|
||||
def secondary_node(zk_conn, node):
|
||||
# Verify node is valid
|
||||
if not common.verifyNode(zk_conn, node):
|
||||
return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node)
|
||||
@ -111,21 +111,12 @@ def secondary_node(zk_conn, node, wait=False):
|
||||
zkhandler.writedata(zk_conn, {
|
||||
'/primary_node': 'none'
|
||||
})
|
||||
|
||||
if wait:
|
||||
# Wait 1 second for lock acquisition
|
||||
time.sleep(1)
|
||||
# Set up and block on a write lock of /primary_node
|
||||
transition_lock = zkhandler.writelock(zk_conn, '/primary_node')
|
||||
transition_lock.acquire()
|
||||
transition_lock.release()
|
||||
retmsg = 'Set node {} in secondary router mode.'.format(node)
|
||||
else:
|
||||
return False, 'Node "{}" is already in secondary router mode.'.format(node)
|
||||
|
||||
return True, retmsg
|
||||
|
||||
def primary_node(zk_conn, node, wait=False):
|
||||
def primary_node(zk_conn, node):
|
||||
# Verify node is valid
|
||||
if not common.verifyNode(zk_conn, node):
|
||||
return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node)
|
||||
@ -147,15 +138,6 @@ def primary_node(zk_conn, node, wait=False):
|
||||
zkhandler.writedata(zk_conn, {
|
||||
'/primary_node': node
|
||||
})
|
||||
|
||||
if wait:
|
||||
# Wait 1 second for lock acquisition
|
||||
time.sleep(1)
|
||||
# Set up and block on a write lock of /primary_node
|
||||
transition_lock = zkhandler.writelock(zk_conn, '/primary_node')
|
||||
transition_lock.acquire()
|
||||
transition_lock.release()
|
||||
retmsg = 'Set node {} in primary router mode.'.format(node)
|
||||
else:
|
||||
return False, 'Node "{}" is already in primary router mode.'.format(node)
|
||||
|
||||
|
Reference in New Issue
Block a user