From b4d4867b851bb2f22bf18aa5f109bd2533d5736f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 19 Sep 2014 08:38:15 +0200 Subject: Initial import of mwc version 1.7.2-1 --- debian/patches/003-syslog.diff | 96 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 debian/patches/003-syslog.diff (limited to 'debian/patches/003-syslog.diff') diff --git a/debian/patches/003-syslog.diff b/debian/patches/003-syslog.diff new file mode 100644 index 0000000..4cab507 --- /dev/null +++ b/debian/patches/003-syslog.diff @@ -0,0 +1,96 @@ +Description: add syslog messages on errors +Author: Jörg Frings-Fürst +Forwarded: via mail +Last-Update: 2014-05-22 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: trunk/mwc.py +=================================================================== +--- trunk.orig/mwc.py 2014-09-18 14:47:28.427409601 +0200 ++++ trunk/mwc.py 2014-09-18 14:47:28.411409275 +0200 +@@ -19,6 +19,7 @@ + import sys + import getopt + import traceback ++import syslog + + import subprocess + +@@ -214,25 +215,28 @@ + # initialize session once, not each time this method gets called + # + # add try / except to open mailsession +- # ++ # ++ + try: +- if mailsession is None: +- mailsession = smtplib.SMTP(config.smtphost, config.smtpport) +- if config.useTLS: +- mailsession.ehlo() +- mailsession.starttls() +- mailsession.login(config.smtpusername, config.smtppwd) +- # ++ if mailsession is None: ++ mailsession = smtplib.SMTP(config.smtphost, config.smtpport) ++ if config.useTLS: ++ mailsession.ehlo() ++ mailsession.starttls() ++ mailsession.login(config.smtpusername, config.smtppwd) ++ except: ++ printf('Error: Open smtp-session') ++ syslog.syslog(syslog.LOG_ERR, 'can not open smtp session') ++ exit(4) ++ # + # add try / except to send mail + # ++ try: ++ mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) + except: +- printf('Error: Open smtp-session') +- exit(4) +- try: +- mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) +- except: +- printf('Error: sendmail') +- exit(5) ++ printf('Error: sendmail') ++ syslog.syslog(syslog.LOG_ERR, 'error on sendmail') ++ exit(5) + + # returns a list of all content that is stored locally for a specific site + def getFileContents(shortname): +@@ -319,7 +323,11 @@ + + configMod = '/etc/mwc/mwc-config' + dryrun = None +- ++ ++ # ++ # add syslog open ++ # ++ syslog.openlog() + try: + opts, args = getopt.getopt(sys.argv[1:], 'hc:d:', ['help', 'config=', 'dry-run=']) + except getopt.GetoptError: +@@ -344,11 +352,13 @@ + config = importlib.import_module(fullname) + except: + print('Error: loading config') ++ syslog.syslog(syslog.LOG_ERR, 'can not found / load mwc-config') + sys.exit(2) + try: + os.chdir(config.datadir) + except: + print('Error: datadir not found') ++ syslog.syslog(syslog.LOG_ERR, 'datadir not found') + sys.exit(3) + + if dryrun: +@@ -370,3 +380,5 @@ + mailsession.quit() + mailsession = None + ++ syslog.closelog() ++ +\ No newline at end of file -- cgit v1.2.3