@ -26,7 +26,7 @@ from cli_lib.common import call_api
|
||||
#
|
||||
# Primary functions
|
||||
#
|
||||
def node_coordinator_state(config, node, action):
|
||||
def node_coordinator_state(config, node, action, wait):
|
||||
"""
|
||||
Set node coordinator state state (primary/secondary)
|
||||
|
||||
@ -35,7 +35,8 @@ def node_coordinator_state(config, node, action):
|
||||
API schema: {"message": "{data}"}
|
||||
"""
|
||||
params={
|
||||
'state': action
|
||||
'state': action,
|
||||
'wait': str(wait).lower()
|
||||
}
|
||||
response = call_api(config, 'post', '/node/{node}/coordinator-state'.format(node=node), params=params)
|
||||
|
||||
|
@ -348,7 +348,11 @@ def cli_node():
|
||||
@click.argument(
|
||||
'node'
|
||||
)
|
||||
def node_secondary(node):
|
||||
@click.option(
|
||||
'-w', '--wait', 'wait', is_flag=True, default=False,
|
||||
help='Wait for transition to complete before returning.'
|
||||
)
|
||||
def node_secondary(node, wait):
|
||||
"""
|
||||
Take NODE out of primary router mode.
|
||||
"""
|
||||
@ -360,7 +364,7 @@ def node_secondary(node):
|
||||
click.echo(" node returns to primary state.")
|
||||
click.echo()
|
||||
|
||||
retcode, retmsg = pvc_node.node_coordinator_state(config, node, 'secondary')
|
||||
retcode, retmsg = pvc_node.node_coordinator_state(config, node, 'secondary', wait)
|
||||
cleanup(retcode, retmsg)
|
||||
|
||||
###############################################################################
|
||||
@ -370,7 +374,11 @@ def node_secondary(node):
|
||||
@click.argument(
|
||||
'node'
|
||||
)
|
||||
def node_primary(node):
|
||||
@click.option(
|
||||
'-w', '--wait', 'wait', is_flag=True, default=False,
|
||||
help='Wait for transition to complete before returning.'
|
||||
)
|
||||
def node_primary(node, wait):
|
||||
"""
|
||||
Put NODE into primary router mode.
|
||||
"""
|
||||
@ -382,7 +390,7 @@ def node_primary(node):
|
||||
click.echo(" node returns to primary state.")
|
||||
click.echo()
|
||||
|
||||
retcode, retmsg = pvc_node.node_coordinator_state(config, node, 'primary')
|
||||
retcode, retmsg = pvc_node.node_coordinator_state(config, node, 'primary', wait)
|
||||
cleanup(retcode, retmsg)
|
||||
|
||||
###############################################################################
|
||||
|
Reference in New Issue
Block a user