Add check for scheme in destination

Allows handling invalid cluster names properly.
This commit is contained in:
Joshua Boniface 2024-10-09 00:25:13 -04:00
parent 1d90b066bc
commit a691d26c30
1 changed files with 12 additions and 0 deletions

View File

@ -2112,6 +2112,10 @@ def cli_vm_snapshot_send(
) )
destination_api_key = destination_cluster_config["api_key"] destination_api_key = destination_cluster_config["api_key"]
else: else:
if "http" not in destination:
finish(
False, "ERROR: A valid destination cluster or URI must be specified!"
)
destination_api_uri = destination destination_api_uri = destination
destination_api_key = destination_api_key destination_api_key = destination_api_key
@ -2213,6 +2217,10 @@ def cli_vm_mirror_create(
) )
destination_api_key = destination_cluster_config["api_key"] destination_api_key = destination_cluster_config["api_key"]
else: else:
if "http" not in destination:
finish(
False, "ERROR: A valid destination cluster or URI must be specified!"
)
destination_api_uri = destination destination_api_uri = destination
destination_api_key = destination_api_key destination_api_key = destination_api_key
@ -2306,6 +2314,10 @@ def cli_vm_mirror_promote(
) )
destination_api_key = destination_cluster_config["api_key"] destination_api_key = destination_cluster_config["api_key"]
else: else:
if "http" not in destination:
finish(
False, "ERROR: A valid destination cluster or URI must be specified!"
)
destination_api_uri = destination destination_api_uri = destination
destination_api_key = destination_api_key destination_api_key = destination_api_key