Avoid returning errors with duplicate router mode

Like the previous (new) flush change, these shouldn't be errors, but
simply information "what you want is already done" messages.
This commit is contained in:
Joshua Boniface 2021-06-05 01:13:46 -04:00
parent 505c109875
commit 5d88e92acc
1 changed files with 14 additions and 14 deletions

View File

@ -95,13 +95,13 @@ def secondary_node(zkhandler, node):
# Get current state
current_state = zkhandler.read('/nodes/{}/routerstate'.format(node))
if current_state == 'primary':
retmsg = 'Setting node {} in secondary router mode.'.format(node)
zkhandler.write([
('/config/primary_node', 'none')
])
else:
return False, 'Node "{}" is already in secondary router mode.'.format(node)
if current_state == 'secondary':
return True, 'Node "{}" is already in secondary router mode.'.format(node)
retmsg = 'Setting node {} in secondary router mode.'.format(node)
zkhandler.write([
('/config/primary_node', 'none')
])
return True, retmsg
@ -123,13 +123,13 @@ def primary_node(zkhandler, node):
# Get current state
current_state = zkhandler.read('/nodes/{}/routerstate'.format(node))
if current_state == 'secondary':
retmsg = 'Setting node {} in primary router mode.'.format(node)
zkhandler.write([
('/config/primary_node', node)
])
else:
return False, 'Node "{}" is already in primary router mode.'.format(node)
if current_state == 'primary':
return True, 'Node "{}" is already in primary router mode.'.format(node)
retmsg = 'Setting node {} in primary router mode.'.format(node)
zkhandler.write([
('/config/primary_node', node)
])
return True, retmsg