-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KCore: default to notifications in terminal window
- Loading branch information
1 parent
b8e9892
commit b8bb881
Showing
8 changed files
with
86 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /bin/sh | ||
if [ "$PYTHONEXE" != "" ]; then | ||
alias python=$PYTHONEXE | ||
fi | ||
if test -e "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyCheckout.py" | ||
then | ||
python "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyCheckout.py" "$@" | ||
else | ||
python "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyCheckout.pyc" "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Send a notification by email to a list of recipients about the checkout | ||
# status of different prods. Please set the environment variable CASSIOPEE_EMAIL | ||
# Usage: python notifyCheckout.py --recipients='[email protected] [email protected]' | ||
# Notify a user about the checkout status of different prods, either in the | ||
# terminal window (default) or by email (set the environment variable | ||
# CASSIOPEE_EMAIL and run on localhost) | ||
# Usage: python notifyCheckout.py | ||
# python notifyCheckout.py --email --recipients='[email protected] [email protected]' | ||
import sys | ||
from time import strptime, strftime | ||
|
||
|
@@ -9,6 +11,8 @@ def parseArgs(): | |
import argparse | ||
# Create argument parser | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-e", "--email", action="store_true", | ||
help="Email results. Default: print in terminal") | ||
parser.add_argument("-r", "--recipients", type=str, default='', | ||
help="Single-quoted space-separated list of recipients") | ||
# Parse arguments | ||
|
@@ -35,7 +39,9 @@ def parseArgs(): | |
log_entries.sort(key=lambda x: x[1], reverse=True) | ||
|
||
# Do not send a notification when everything is OK | ||
if not any('FAILED' in log_machine for log_machine in log_entries): sys.exit() | ||
if not any('FAILED' in log_machine for log_machine in log_entries): | ||
if script_args.email: sys.exit() | ||
else: print("[Checkout Cassiopee] State: OK") | ||
|
||
# Get git info | ||
cassiopeeIncDir = '/stck/cassiope/git/Cassiopee/Cassiopee' | ||
|
@@ -45,9 +51,9 @@ def parseArgs(): | |
gitInfo = "Git origin: {}\nGit branch: {}\nCommit hash: {}".format( | ||
gitOrigin, gitBranch, gitHash) | ||
|
||
baseState = 'FAILED' | ||
messageSubject = "[Checkout Cassiopee] State: FAILED" | ||
messageText = "Pulling updates for Cassiopee, Fast and all "\ | ||
"PModules:\n{}\n\n{}\n\n\n".format(52*'-', gitInfo) | ||
"PModules:\n{}\n\n{}\n\n".format(52*'-', gitInfo) | ||
messageText += '{:^20} | {:^15} | {:^30} | {:^10}\n{}\n'.format( | ||
"PROD.", "PCKG.", "DATE", "STATUS", 85*'-') | ||
for log_machine in log_entries: | ||
|
@@ -63,6 +69,9 @@ def parseArgs(): | |
'please contact the maintainers:\n[email protected], '\ | ||
'[email protected]' | ||
|
||
notify(recipients=recipients, | ||
messageSubject="[Checkout Cassiopee] State: {}".format(baseState), | ||
messageText=messageText) | ||
if script_args.email: | ||
notify(recipients=recipients, | ||
messageSubject=messageSubject, | ||
messageText=messageText) | ||
else: | ||
print("{0}\n|{1:^65}|\n{0}\n{2}".format(67*'-', messageSubject, messageText)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /bin/sh | ||
if [ "$PYTHONEXE" != "" ]; then | ||
alias python=$PYTHONEXE | ||
fi | ||
if test -e "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyInstall.py" | ||
then | ||
python "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyInstall.py" "$@" | ||
else | ||
python "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyInstall.pyc" "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Send a notification by email to a list of recipients about the installation | ||
# status of different prods. Please set the environment variable CASSIOPEE_EMAIL | ||
# Usage: python notifyInstall.py --recipients='[email protected] [email protected]' | ||
# Notify a user about the installation status of different prods, either in the | ||
# terminal window (default) or by email (set the environment variable | ||
# CASSIOPEE_EMAIL and run on localhost) | ||
# Usage: python notifyInstall.py | ||
# python notifyInstall.py --email --recipients='[email protected] [email protected]' | ||
import sys | ||
from time import strptime, strftime | ||
|
||
|
@@ -9,6 +11,8 @@ def parseArgs(): | |
import argparse | ||
# Create argument parser | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-e", "--email", action="store_true", | ||
help="Email results. Default: print in terminal") | ||
parser.add_argument("-r", "--recipients", type=str, default='', | ||
help="Single-quoted space-separated list of recipients") | ||
# Parse arguments | ||
|
@@ -44,7 +48,7 @@ def parseArgs(): | |
|
||
baseState = 'OK' | ||
messageText = "Installation of Cassiopee, Fast and all "\ | ||
"PModules:\n{}\n\n{}\n\n\n".format(48*'-', gitInfo) | ||
"PModules:\n{}\n\n{}\n\n".format(48*'-', gitInfo) | ||
messageText += '{:^20} | {:^30} | {:^10}\n{}\n'.format( | ||
"PROD.", "DATE", "STATUS", 67*'-') | ||
for log_machine in log_entries: | ||
|
@@ -55,11 +59,15 @@ def parseArgs(): | |
messageText += '{:^20} | {:^30} | {:^10}\n'.format(prod, date, status) | ||
if 'FAILED' in log_machine: baseState = 'FAILED' | ||
|
||
messageSubject = "[Install Cassiopee] State: {}".format(baseState) | ||
if baseState == 'FAILED': | ||
messageText += '\n\nIf the prod. you wish to use is marked as FAILED, '\ | ||
'please contact the maintainers:\n[email protected], '\ | ||
'[email protected]' | ||
|
||
notify(recipients=recipients, | ||
messageSubject="[Install Cassiopee] State: {}".format(baseState), | ||
messageText=messageText) | ||
if script_args.email: | ||
notify(recipients=recipients, | ||
messageSubject=messageSubject, | ||
messageText=messageText) | ||
else: | ||
print("{0}\n|{1:^65}|\n{0}\n{2}".format(67*'-', messageSubject, messageText)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /bin/sh | ||
if [ "$PYTHONEXE" != "" ]; then | ||
alias python=$PYTHONEXE | ||
fi | ||
if test -e "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyValid.py" | ||
then | ||
python "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyValid.py" "$@" | ||
else | ||
python "$CASSIOPEE/Dist/bin/$ELSAPROD/notifyValid.pyc" "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Send a notification by email to a list of recipients about the validation | ||
# status of different prods. Please set the environment variable CASSIOPEE_EMAIL | ||
# Usage: python notifyValid.py --recipients='[email protected] [email protected]' | ||
# Notify a user about the validation status of different prods, either in the | ||
# terminal window (default) or by email (set the environment variable | ||
# CASSIOPEE_EMAIL and run on localhost) | ||
# Usage: python notifyValid.py | ||
# python notifyValid.py --email --recipients='[email protected] [email protected]' | ||
import sys | ||
from time import strptime, strftime | ||
|
||
|
@@ -9,6 +11,8 @@ def parseArgs(): | |
import argparse | ||
# Create argument parser | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-e", "--email", action="store_true", | ||
help="Email results. Default: print in terminal") | ||
parser.add_argument("-r", "--recipients", type=str, default='', | ||
help="Single-quoted space-separated list of recipients") | ||
# Parse arguments | ||
|
@@ -44,7 +48,7 @@ def parseArgs(): | |
|
||
vnvState = 'OK' | ||
messageText = "Non-regression testing of Cassiopee, Fast and all "\ | ||
"PModules:\n{}\n\n{}\n\n\n".format(58*'-', gitInfo) | ||
"PModules:\n{}\n\n{}\n\n".format(58*'-', gitInfo) | ||
messageText += '{:^20} | {:^30} | {:^10}\n{}\n'.format( | ||
"PROD.", "DATE", "STATUS", 67*'-') | ||
for log_machine in log_entries: | ||
|
@@ -55,11 +59,15 @@ def parseArgs(): | |
messageText += '{:^20} | {:^30} | {:^10}\n'.format(prod, date, status) | ||
if 'FAILED' in log_machine: vnvState = 'FAILED' | ||
|
||
messageSubject = "[V&V Cassiopee] State: {}".format(vnvState) | ||
if vnvState == 'FAILED': | ||
messageText += '\n\nIf the prod. you wish to use is marked as FAILED, '\ | ||
'please contact the maintainers:\n[email protected], '\ | ||
'[email protected]' | ||
|
||
notify(recipients=recipients, | ||
messageSubject="[V&V Cassiopee] State: {}".format(vnvState), | ||
messageText=messageText) | ||
if script_args.email: | ||
notify(recipients=recipients, | ||
messageSubject=messageSubject, | ||
messageText=messageText) | ||
else: | ||
print("{0}\n|{1:^65}|\n{0}\n{2}".format(67*'-', messageSubject, messageText)) |