Clean up redundant message output

This commit is contained in:
Joshua Boniface 2020-02-19 16:22:29 -05:00
parent 65932b20d2
commit 0caea03428
1 changed files with 28 additions and 28 deletions

View File

@ -368,21 +368,21 @@ def node_secondary(node, wait):
if not retcode: if not retcode:
cleanup(retcode, retmsg) cleanup(retcode, retmsg)
else: else:
click.echo(retmsg) if wait:
if wait: click.echo(retmsg)
click.echo("Waiting for state transition... ", nl=False) click.echo("Waiting for state transition... ", nl=False)
# Every half-second, check if the API is reachable and the node is in secondary state # Every half-second, check if the API is reachable and the node is in secondary state
while True: while True:
try: try:
_retcode, _retmsg = pvc_node.node_info(config, node) _retcode, _retmsg = pvc_node.node_info(config, node)
if _retmsg['coordinator_state'] == 'secondary': if _retmsg['coordinator_state'] == 'secondary':
retmsg = "done." retmsg = "done."
break break
else: else:
time.sleep(0.5)
except:
time.sleep(0.5) time.sleep(0.5)
except: cleanup(retcode, retmsg)
time.sleep(0.5)
cleanup(retcode, retmsg)
############################################################################### ###############################################################################
# pvc node primary # pvc node primary
@ -411,21 +411,21 @@ def node_primary(node, wait):
if not retcode: if not retcode:
cleanup(retcode, retmsg) cleanup(retcode, retmsg)
else: else:
click.echo(retmsg) if wait:
if wait: click.echo(retmsg)
click.echo("Waiting for state transition... ", nl=False) click.echo("Waiting for state transition... ", nl=False)
# Every half-second, check if the API is reachable and the node is in secondary state # Every half-second, check if the API is reachable and the node is in secondary state
while True: while True:
try: try:
_retcode, _retmsg = pvc_node.node_info(config, node) _retcode, _retmsg = pvc_node.node_info(config, node)
if _retmsg['coordinator_state'] == 'primary': if _retmsg['coordinator_state'] == 'primary':
retmsg = "done." retmsg = "done."
break break
else: else:
time.sleep(0.5)
except:
time.sleep(0.5) time.sleep(0.5)
except: cleanup(retcode, retmsg)
time.sleep(0.5)
cleanup(retcode, retmsg)
############################################################################### ###############################################################################
# pvc node flush # pvc node flush