Skip to content

Commit

Permalink
Merge pull request #11092 from openshift-cherrypick-robot/cherry-pick…
Browse files Browse the repository at this point in the history
…-11091-to-release-4.17

[release-4.17] Consider destroy of cluster to be completed if resource group not found
  • Loading branch information
petr-balogh authored Jan 2, 2025
2 parents 1069581 + 9061746 commit ea4de1c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions ocs_ci/utility/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2017,11 +2017,11 @@ def get_ocs_build_number():
operator_name = defaults.HCI_CLIENT_ODF_OPERATOR_NAME
else:
operator_name = defaults.OCS_OPERATOR_NAME
ocs_csvs = get_csvs_start_with_prefix(
operator_name,
config.ENV_DATA["cluster_namespace"],
)
try:
ocs_csvs = get_csvs_start_with_prefix(
operator_name,
config.ENV_DATA["cluster_namespace"],
)
ocs_csv = ocs_csvs[0]
csv_labels = ocs_csv["metadata"]["labels"]
if "full_version" in csv_labels:
Expand Down Expand Up @@ -3468,9 +3468,16 @@ def destroy_cluster(installer, cluster_path, log_level="DEBUG"):
# Execute destroy cluster using OpenShift installer
log.info(f"Destroying cluster defined in {cluster_path}")
run_cmd(destroy_cmd, timeout=1200)
except CommandFailed:
log.error(traceback.format_exc())
raise
except CommandFailed as ex:
error_message = str(ex)
# Check for the specific "ResourceGroup not found" error
if re.search(r"ResourceGroup .* not found", error_message):
log.warning(
f"Resource group not found. Assuming cluster is already destroyed. Exception {error_message}"
)
else:
log.error(traceback.format_exc())
raise
except Exception:
log.error(traceback.format_exc())

Expand Down

0 comments on commit ea4de1c

Please sign in to comment.