From 53aed0a735b9767ef10a5d835dff6c0c2eee799a Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 13 Jan 2022 18:36:20 -0500 Subject: [PATCH] Use a singular configured cluster by default If there is... 1. No '--cluster' passed, and 2. No 'local' cluster, and 3. There is exactly one cluster configured ...then use that cluster by default in the CLI. --- client-cli/pvc/pvc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client-cli/pvc/pvc.py b/client-cli/pvc/pvc.py index 2ce38a55..d7a97657 100755 --- a/client-cli/pvc/pvc.py +++ b/client-cli/pvc/pvc.py @@ -5741,6 +5741,11 @@ def cli(_cluster, _debug, _quiet, _unsafe, _colour): global config store_data = get_store(store_path) config = get_config(store_data, _cluster) + + # There is only one cluster and no local cluster, so even if nothing was passed, use it + if len(store_data) == 1 and _cluster is None and config.get("badcfg", None): + config = get_config(store_data, list(store_data.keys())[0]) + if not config.get("badcfg", None): config["debug"] = _debug config["unsafe"] = _unsafe