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
|
# 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':
|
||||||
retmsg = 'Setting node {} in secondary router mode.'.format(node)
|
return True, 'Node "{}" is already in secondary router mode.'.format(node)
|
||||||
zkhandler.write([
|
|
||||||
('/config/primary_node', 'none')
|
retmsg = 'Setting node {} in secondary router mode.'.format(node)
|
||||||
])
|
zkhandler.write([
|
||||||
else:
|
('/config/primary_node', 'none')
|
||||||
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':
|
||||||
retmsg = 'Setting node {} in primary router mode.'.format(node)
|
return True, 'Node "{}" is already in primary router mode.'.format(node)
|
||||||
zkhandler.write([
|
|
||||||
('/config/primary_node', node)
|
retmsg = 'Setting node {} in primary router mode.'.format(node)
|
||||||
])
|
zkhandler.write([
|
||||||
else:
|
('/config/primary_node', node)
|
||||||
return False, 'Node "{}" is already in primary router mode.'.format(node)
|
])
|
||||||
|
|
||||||
return True, retmsg
|
return True, retmsg
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue