From f80b432d3b810d2de897f9ee212b2469bc7184c3 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 2 Jan 2020 12:18:41 -0500 Subject: [PATCH] Handle the empty list better --- client-cli/pvc.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index 7612bede..2043b0b1 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -225,6 +225,8 @@ def cluster_list(): cfgfile = cluster_details.get('cfgfile') if os.path.isfile(cfgfile): address, port, scheme = read_from_yaml(cfgfile) + else: + address, port, scheme = 'N/A', 'N/A', 'N/A' else: address = cluster_details.get('host', None) port = cluster_details.get('port', None) @@ -1938,6 +1940,10 @@ def status_cluster(oformat): """ Show basic information and health for the active PVC cluster. """ + # Abort commands under this group if config is bad + if config.get('badcfg', None): + exit(1) + retcode, retdata = pvc_cluster.get_info(config) if retcode: pvc_cluster.format_info(retdata, oformat) @@ -1957,6 +1963,9 @@ def init_cluster(yes): """ Perform initialization of a new PVC cluster. """ + # Abort commands under this group if config is bad + if config.get('badcfg', None): + exit(1) if not yes: click.echo('DANGER: This will remove any existing cluster on these coordinators and create a new cluster. Any existing resources on the old cluster will be left abandoned.')