Skip to content

Commit 06d6f5a

Browse files
authored
Handle a missing desired_state gracefully (#38)
1 parent 1a9a18c commit 06d6f5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

generate-status/write_status.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
else:
2929
existing_status = False
3030

31-
if "current_state" not in subject["ocp_anarchy_subject"]["spec"]["vars"] or "desired_state" not in subject["ocp_anarchy_subject"]["spec"]["vars"]:
31+
if "current_state" not in subject["ocp_anarchy_subject"]["spec"]["vars"]:
3232
print(f"Skipping {subject['directory']} - state information not found in the Anarchy subject")
3333
return
3434

@@ -40,7 +40,7 @@
4040
return
4141

4242
current_state = subject["ocp_anarchy_subject"]["spec"]["vars"]["current_state"]
43-
desired_state = subject["ocp_anarchy_subject"]["spec"]["vars"]["desired_state"]
43+
desired_state = subject["ocp_anarchy_subject"]["spec"]["vars"]["desired_state"] if "desired_state" in subject["ocp_anarchy_subject"]["spec"]["vars"] else None
4444

4545
region = engagement["engagement_region"].lower() if "engagement_region" in engagement else "na"
4646
region_url = f"{region}-1"
@@ -61,7 +61,7 @@
6161
if current_state == "provisioning":
6262
ocp_subsystem["status"] = "yellow"
6363
ocp_subsystem["info"] = "Building Cluster. This normally takes about ~45 min from launch. Please check back later for an updated status."
64-
elif current_state == desired_state :
64+
elif current_state == desired_state or (current_state == "started" and desired_state is None):
6565
ocp_subsystem["status"] = "green"
6666
ocp_subsystem["info"] = "Working as expected"
6767
else:

0 commit comments

Comments
 (0)