Skip to content

Commit

Permalink
refactor environmental check
Browse files Browse the repository at this point in the history
Signed-off-by: vavuthu <vavuthu@redhat.com>
  • Loading branch information
vavuthu authored and fbalak committed Jun 14, 2024
1 parent 27d5eca commit 71a9e70
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions ocs_ci/utility/environment_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,21 @@ def assign_get_values(env_status_dict, key, kind=None, exclude_labels=None):
for item in items:
ns = item.get("metadata", {}).get("namespace")
if item.get("kind") == constants.PV:
ns = item.get("spec").get("claimRef").get("namespace")
ns = item.get("spec").get("claimRef", {}).get("namespace")

item_labels = item.get("metadata", {}).get("labels", {})
excluded_item_labels = [
f"{key}={value}"
for key, value in item_labels.items()
if f"{key}={value}" in exclude_labels
]
if exclude_labels:
excluded_item_labels = [
f"{key}={value}"
for key, value in item_labels.items()
if f"{key}={value}" in exclude_labels
]

if excluded_item_labels:
log.debug(
"ignoring item with app label %s: %s", excluded_item_labels[0], item
)
continue

if (
ns is not None
Expand All @@ -89,11 +96,6 @@ def assign_get_values(env_status_dict, key, kind=None, exclude_labels=None):
):
log.debug("ignoring item in %s namespace: %s", ns, item)
continue
if excluded_item_labels:
log.debug(
"ignoring item with app label %s: %s", excluded_item_labels[0], item
)
continue
if item.get("kind") == constants.POD:
name = item.get("metadata", {}).get("name", "")
if name.endswith("-debug") or "-debug-" in name:
Expand Down

0 comments on commit 71a9e70

Please sign in to comment.