Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.14] Consider destroy of cluster to be completed if resource group not found #11095

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions ocs_ci/utility/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1904,11 +1904,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 @@ -3281,9 +3281,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
Loading