8
8
EPICS_DIR = "C:\\ Instrument\\ Apps\\ EPICS\\ "
9
9
SSH_USERNAME = os .environ ["SSH_CREDENTIALS_USR" ]
10
10
SSH_PASSWORD = os .environ ["SSH_CREDENTIALS_PSW" ]
11
+ WORKSPACE_DIR = os .environ ["WORKSPACE" ]
11
12
12
13
USE_TEST_INSTRUMENT_LIST = os .environ ["USE_TEST_INSTRUMENT_LIST" ] == "true"
13
14
TEST_INSTRUMENT_LIST = os .environ ["TEST_INSTRUMENT_LIST" ]
@@ -22,6 +23,25 @@ class CHECK(Enum):
22
23
FALSE = 2
23
24
24
25
26
+ def save_to_file (path , data ):
27
+ """ Save data to a file in the workspace directory.
28
+
29
+ Args:
30
+ hostname (str): The hostname to connect to.
31
+ path (str): The path to save the file to.
32
+ data (str): The data to save to the file.
33
+
34
+ Returns:
35
+ None
36
+ """
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 )))
40
+
41
+ with open (os .path .join (WORKSPACE_DIR + path ), "w" ) as file :
42
+ file .write (data )
43
+
44
+
25
45
def get_insts_on_latest_ibex_via_inst_congif ():
26
46
""" Get a list of instruments that are on the latest version of IBEX via the inst_config file.
27
47
@@ -44,7 +64,7 @@ def get_insts_on_latest_ibex_via_inst_congif():
44
64
45
65
# Get the latest version of IBEX
46
66
latest_version = max ([inst ["version" ]
47
- for inst in result_list ])
67
+ for inst in result_list ])
48
68
49
69
# filter out the instruments that are not on the latest version
50
70
insts_on_latest_ibex = [inst ["hostname" ] for inst in result_list if
@@ -67,6 +87,9 @@ def check_for_uncommitted_changes(hostname):
67
87
hostname , SSH_USERNAME , SSH_PASSWORD , command )
68
88
69
89
if ssh_process ['success' ]:
90
+ # log the output to a workspace file for viewing later
91
+ save_to_file ("/git_status/" + hostname + '.txt' , ssh_process ['output' ])
92
+
70
93
if ssh_process ['output' ].strip () != "" :
71
94
return CHECK .TRUE
72
95
else :
0 commit comments