Index: build/alarmMapping.py =================================================================== diff -u -r71d1146edb753c070b9e92e59e7c3695643ea63b -rd8b2aed407f3f3ad180260692c0ddf36c93f759f --- build/alarmMapping.py (.../alarmMapping.py) (revision 71d1146edb753c070b9e92e59e7c3695643ea63b) +++ build/alarmMapping.py (.../alarmMapping.py) (revision d8b2aed407f3f3ad180260692c0ddf36c93f759f) @@ -1,10 +1,22 @@ #!/usr/bin/python3 +import sys from openpyxl import load_workbook +# Default source and destination values for a local run src = "Alarms.xlsx" dst = "/home/denali/Projects/application/resources/settings/Alarms/Alarms.conf" +try: + # Source is the first input argument + # Destination is the second input argument + # NOTE: try and except was used to make sure when this script is run locally, it can be called without passing any + # input arguments even as empty strings. In case of an exception do nothing and just pass. + src = sys.argv[1] + dst = sys.argv[2] +except: + pass + exl = load_workbook(src) if 'Alarms' in exl.sheetnames: @@ -47,7 +59,6 @@ conf_content += "Title = {}\n" .format(val_alarm_title ) conf_content += "Message = {}\n" .format(val_alarm_message ) - val = alarms.cell(row=row, column=col_instruction_title ).value val_instruction_title = "" if val == None or val == 'N/A' else val.strip() Index: build/unittest.sh =================================================================== diff -u -rd730a03a26359213bf04fd83b21afccd80abbdb3 -rd8b2aed407f3f3ad180260692c0ddf36c93f759f --- build/unittest.sh (.../unittest.sh) (revision d730a03a26359213bf04fd83b21afccd80abbdb3) +++ build/unittest.sh (.../unittest.sh) (revision d8b2aed407f3f3ad180260692c0ddf36c93f759f) @@ -129,6 +129,14 @@ cd $currentDir cp ../scripts/build/AlarmMapping.csv $reportDir + + cd ../scripts/build + rm -rf Alarms.xlsx + cp -r /media/Denali06Alarms/Alarms.xlsx "$(pwd)" + + python3 ./build/alarmMapping.py Alarms.xlsx "$(pwd)" + git commit -avm "Bamboo Commit: Copied the Alarms table" + cd "$currentDir" } function make_Directories() {