From 0caea03428d6d1b47eb2c8e3af44069edee850ff Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 19 Feb 2020 16:22:29 -0500 Subject: [PATCH] Clean up redundant message output --- client-cli/pvc.py | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index a740861b..1ada8592 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -368,21 +368,21 @@ def node_secondary(node, wait): if not retcode: cleanup(retcode, retmsg) else: - click.echo(retmsg) - if wait: - click.echo("Waiting for state transition... ", nl=False) - # Every half-second, check if the API is reachable and the node is in secondary state - while True: - try: - _retcode, _retmsg = pvc_node.node_info(config, node) - if _retmsg['coordinator_state'] == 'secondary': - retmsg = "done." - break - else: + if wait: + click.echo(retmsg) + click.echo("Waiting for state transition... ", nl=False) + # Every half-second, check if the API is reachable and the node is in secondary state + while True: + try: + _retcode, _retmsg = pvc_node.node_info(config, node) + if _retmsg['coordinator_state'] == 'secondary': + retmsg = "done." + break + else: + time.sleep(0.5) + except: time.sleep(0.5) - except: - time.sleep(0.5) - cleanup(retcode, retmsg) + cleanup(retcode, retmsg) ############################################################################### # pvc node primary @@ -411,21 +411,21 @@ def node_primary(node, wait): if not retcode: cleanup(retcode, retmsg) else: - click.echo(retmsg) - if wait: - click.echo("Waiting for state transition... ", nl=False) - # Every half-second, check if the API is reachable and the node is in secondary state - while True: - try: - _retcode, _retmsg = pvc_node.node_info(config, node) - if _retmsg['coordinator_state'] == 'primary': - retmsg = "done." - break - else: + if wait: + click.echo(retmsg) + click.echo("Waiting for state transition... ", nl=False) + # Every half-second, check if the API is reachable and the node is in secondary state + while True: + try: + _retcode, _retmsg = pvc_node.node_info(config, node) + if _retmsg['coordinator_state'] == 'primary': + retmsg = "done." + break + else: + time.sleep(0.5) + except: time.sleep(0.5) - except: - time.sleep(0.5) - cleanup(retcode, retmsg) + cleanup(retcode, retmsg) ############################################################################### # pvc node flush