Skip to content

Commit 31eadec

Browse files
author
Isaac Hill
committed
Creating dir wrong I think so solved
1 parent d362355 commit 31eadec

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

hotfix_checker.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CHECK(Enum):
2323
FALSE = 2
2424

2525

26-
def save_to_file(hostname, path, data):
26+
def save_to_file(path, data):
2727
""" Save data to a file in the workspace directory.
2828
2929
Args:
@@ -34,10 +34,11 @@ def save_to_file(hostname, path, data):
3434
Returns:
3535
None
3636
"""
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)))
3940

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:
4142
file.write(data)
4243

4344

@@ -63,7 +64,7 @@ def get_insts_on_latest_ibex_via_inst_congif():
6364

6465
# Get the latest version of IBEX
6566
latest_version = max([inst["version"]
66-
for inst in result_list])
67+
for inst in result_list])
6768

6869
# filter out the instruments that are not on the latest version
6970
insts_on_latest_ibex = [inst["hostname"] for inst in result_list if
@@ -87,8 +88,7 @@ def check_for_uncommitted_changes(hostname):
8788

8889
if ssh_process['success']:
8990
# 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'])
9292

9393
if ssh_process['output'].strip() != "":
9494
return CHECK.TRUE

0 commit comments

Comments
 (0)