From a691d26c30a40e8a4cdfdbd16f21de756bd7595e Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 9 Oct 2024 00:25:13 -0400 Subject: [PATCH] Add check for scheme in destination Allows handling invalid cluster names properly. --- client-cli/pvc/cli/cli.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client-cli/pvc/cli/cli.py b/client-cli/pvc/cli/cli.py index bfb6b845..f959a4a0 100644 --- a/client-cli/pvc/cli/cli.py +++ b/client-cli/pvc/cli/cli.py @@ -2112,6 +2112,10 @@ def cli_vm_snapshot_send( ) destination_api_key = destination_cluster_config["api_key"] else: + if "http" not in destination: + finish( + False, "ERROR: A valid destination cluster or URI must be specified!" + ) destination_api_uri = destination destination_api_key = destination_api_key @@ -2213,6 +2217,10 @@ def cli_vm_mirror_create( ) destination_api_key = destination_cluster_config["api_key"] else: + if "http" not in destination: + finish( + False, "ERROR: A valid destination cluster or URI must be specified!" + ) destination_api_uri = destination destination_api_key = destination_api_key @@ -2306,6 +2314,10 @@ def cli_vm_mirror_promote( ) destination_api_key = destination_cluster_config["api_key"] else: + if "http" not in destination: + finish( + False, "ERROR: A valid destination cluster or URI must be specified!" + ) destination_api_uri = destination destination_api_key = destination_api_key