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:
parent
505c109875
commit
5d88e92acc
|
@ -95,13 +95,13 @@ def secondary_node(zkhandler, node):
|
|||
|
||||
# Get current state
|
||||
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)
|
||||
zkhandler.write([
|
||||
('/config/primary_node', 'none')
|
||||
])
|
||||
else:
|
||||
return False, 'Node "{}" is already in secondary router mode.'.format(node)
|
||||
|
||||
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':
|
||||
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)
|
||||
])
|
||||
else:
|
||||
return False, 'Node "{}" is already in primary router mode.'.format(node)
|
||||
|
||||
return True, retmsg
|
||||
|
||||
|
|
Loading…
Reference in New Issue