From 86236b7e7741ccb26bafe1e3dadeb4e453ab5437 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Tue, 1 Jun 2021 17:31:14 -0600 Subject: [PATCH] lf_check.py lf_check_config_template.ini : email update , bug fix Signed-off-by: Chuck SmileyRekiere --- py-scripts/tools/lf_check.py | 17 ++++++++--------- py-scripts/tools/lf_check_config_template.ini | 1 + 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/py-scripts/tools/lf_check.py b/py-scripts/tools/lf_check.py index d0b172ff..0bfa8ac0 100755 --- a/py-scripts/tools/lf_check.py +++ b/py-scripts/tools/lf_check.py @@ -110,16 +110,15 @@ class lf_check(): # Following recommendation # NOTE: https://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-from-nic-in-python #command = 'echo "$HOSTNAME mail system works!" | mail -s "Test: $HOSTNAME $(date)" chuck.rekiere@candelatech.com' - if(self.production_run == "TRUE"): - command = 'echo "$HOSTNAME {}/html-report/lf_check_latest.html " | mail -s "Regression Test Results from: $HOSTNAME $(date)" {}'.format(self.host_ip_production,self.email_list_production) - else: - command = 'echo "$HOSTNAME {}/html-report/lf_check_latest.html " | mail -s "Regression Test Results from: $HOSTNAME $(date)" {}'.format(self.host_ip_test,self.email_list_test) - - print("running {}".format(command)) - process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) - try: - #out, err = process.communicate() + if(self.production_run == "TRUE"): + command = 'echo "Results from $HOSTNAME {}/html-reports/lf_check_latest.html " | mail -s "Regression Test Results from: $HOSTNAME $(date)" {}'.format(self.host_ip_production,self.email_list_production) + else: + command = 'echo "Results from $HOSTNAME {}/html-reports/lf_check_latest.html " | mail -s "Regression Test Results from: $HOSTNAME $(date)" {}'.format(self.host_ip_test,self.email_list_test) + + print("running {}".format(command)) + process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + # have email on separate timeout process.wait(timeout=int(self.test_timeout)) except subprocess.TimeoutExpired: print("send email timed out") diff --git a/py-scripts/tools/lf_check_config_template.ini b/py-scripts/tools/lf_check_config_template.ini index 4c773332..36de2559 100755 --- a/py-scripts/tools/lf_check_config_template.ini +++ b/py-scripts/tools/lf_check_config_template.ini @@ -24,6 +24,7 @@ LOAD_FACTORY_DEFAULT_DB = TRUE LOAD_CUSTOM_DB = FALSE CUSTOM_DB = DFLT_ETH1_GEN PRODUCTION_RUN = FALSE # determine whom to send emails to +#EMAIL_LIST_PRODUCTION = scripters@candelatech.com EMAIL_LIST_PRODUCTION = chuck.rekiere@candelatech.com HOST_IP_PRODUCTION = 192.168.95.6 EMAIL_LIST_TEST = chuck.rekiere@candelatech.com