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