@@ -23,7 +23,7 @@ class CHECK(Enum):
23
23
FALSE = 2
24
24
25
25
26
- def save_to_file (hostname , path , data ):
26
+ def save_to_file (path , data ):
27
27
""" Save data to a file in the workspace directory.
28
28
29
29
Args:
@@ -34,10 +34,11 @@ def save_to_file(hostname, path, data):
34
34
Returns:
35
35
None
36
36
"""
37
- if not os .path .exists (WORKSPACE_DIR + path ):
38
- os .makedirs (WORKSPACE_DIR + path )
37
+ # check if the parent dir exists
38
+ if not os .path .exists (os .path .join (WORKSPACE_DIR + os .path .dirname (path ))):
39
+ os .makedirs (os .path .join (WORKSPACE_DIR + os .path .dirname (path )))
39
40
40
- with open (os .path .join (WORKSPACE_DIR + path + hostname + '.txt' ), "w" ) as file :
41
+ with open (os .path .join (WORKSPACE_DIR + path ), "w" ) as file :
41
42
file .write (data )
42
43
43
44
@@ -63,7 +64,7 @@ def get_insts_on_latest_ibex_via_inst_congif():
63
64
64
65
# Get the latest version of IBEX
65
66
latest_version = max ([inst ["version" ]
66
- for inst in result_list ])
67
+ for inst in result_list ])
67
68
68
69
# filter out the instruments that are not on the latest version
69
70
insts_on_latest_ibex = [inst ["hostname" ] for inst in result_list if
@@ -87,8 +88,7 @@ def check_for_uncommitted_changes(hostname):
87
88
88
89
if ssh_process ['success' ]:
89
90
# log the output to a workspace file for viewing later
90
-
91
- save_to_file (hostname , "/git_status/" , ssh_process ['output' ])
91
+ save_to_file ("/git_status/" + hostname + '.txt' , ssh_process ['output' ])
92
92
93
93
if ssh_process ['output' ].strip () != "" :
94
94
return CHECK .TRUE
0 commit comments