File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
2
import datetime
3
+ from os import path
3
4
4
5
subject = context ["repositories" ]
5
6
21
22
with open (f"../../{ subject ['directory' ]} /engagement.json" , "r" ) as read_file :
22
23
engagement = json .load (read_file )
23
24
25
+ if path .exists (f"../../{ subject ['directory' ]} /status.json" ):
26
+ with open (f"../../{ subject ['directory' ]} /status.json" , "r" ) as read_file :
27
+ existing_status = json .load (read_file )
28
+ else :
29
+ existing_status = False
30
+
24
31
if "current_state" not in subject ["anarchy_subject" ]["spec" ]["vars" ] or "desired_state" not in subject ["anarchy_subject" ]["spec" ]["vars" ]:
25
32
print (f"Skipping { subject ['directory' ]} - state information not found in the Anarchy subject" )
26
33
return
27
34
35
+ if existing_status :
36
+ existing_ocp_subsystem = [subsystem for subsystem in existing_status ["subsystems" ] if subsystem ["name" ] == "OpenShift" ]
37
+ if len (existing_ocp_subsystem ) > 0 :
38
+ if subject ["anarchy_subject" ]["spec" ]["vars" ]["current_state" ] == existing_ocp_subsystem [0 ]["state" ]:
39
+ print (f"Skipping { subject ['directory' ]} - state has not changed since last update" )
40
+ return
41
+
28
42
current_state = subject ["anarchy_subject" ]["spec" ]["vars" ]["current_state" ]
29
43
desired_state = subject ["anarchy_subject" ]["spec" ]["vars" ]["desired_state" ]
30
44
You can’t perform that action at this time.
0 commit comments