Commit 600f5be1 authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

correction

This is a legacy commit from before 2015-05-18.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.

SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 4387
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent b0d8ccd7
......@@ -46,7 +46,6 @@ import re
import smtplib
import logging
import csbacklog
import pidlock
from email.mime.text import MIMEText
from collections import deque
......@@ -130,7 +129,7 @@ def main(argv=None):
"verbose", "debug", "logging", "receiver=", "sender=", "port=", \
"host=", "username=", "password="])
except getopt.GetoptError as err:
raise Usage(133,err.msg)
raise Usage(132,err.msg)
verbose = False
debugMode = False
receivers = []
......@@ -181,20 +180,20 @@ def main(argv=None):
if None != re.match('csback\.log|csback\.log\.[1-5]', logfile)]
logFilePathes.reverse()
else:
raise Usage(184,"Invalid argument(s).")
raise Usage(183,"Invalid argument(s).")
logger.getLogger().debug("Checking email addresses.")
if 0 == len(sender):
raise Usage(188, "Email address of sender missing.")
raise Usage(187, "Email address of sender missing.")
if None == re.match( \
'^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$', sender):
raise Error(191, "Email address of sender not valid.")
raise Error(190, "Email address of sender not valid.")
if 0 == len(receivers):
raise Usage(193, "Email address of receiver missing.")
raise Usage(192, "Email address of receiver missing.")
for add in receivers:
if None == re.match( \
'^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$', add):
raise Error(197, "Email address of receiver not valid.")
raise Error(196, "Email address of receiver not valid.")
infoDequeue = deque(maxlen=10)
warningDequeue = deque(maxlen=10)
......@@ -216,7 +215,7 @@ def main(argv=None):
else:
logger.getLogger().info("Illegal line in logfile found.")
except IOError as err:
raise Error(219, "Error while reading logfiles.")
raise Error(218, "Error while reading logfiles.")
logger.getLogger().debug("Finished reading logfile(s).")
# prepare email
......@@ -300,10 +299,6 @@ def main(argv=None):
except Usage as err:
err.display()
return 2
except pidlock.PidLockError as err:
logger.getLogger().error("{0}".format(err.msg))
err.display()
return 2
except Error as err:
logger.getLogger().error("message: %s [line %s]", err.msg, err.line)
err.display()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment