mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/tglx/remail.git
synced 2024-11-24 21:32:39 +01:00
remail/remaild: Use correct path for frozen mails and update log message
Store the frozen mails in maildir.frozen/new and not in the base directory. Move the log message to the actual frozen handling function and provide the correct file pathes in the log. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
d7b8db9b96
commit
e3a2f4bc1d
1 changed files with 6 additions and 7 deletions
|
@ -166,15 +166,19 @@ class remaild(object):
|
||||||
|
|
||||||
def move_frozen(self, mailfile):
|
def move_frozen(self, mailfile):
|
||||||
try:
|
try:
|
||||||
|
txt = 'Failed to process mail file %s\n' %(mailfile)
|
||||||
|
self.logger.log_warn(txt)
|
||||||
fname = os.path.basename(mailfile)
|
fname = os.path.basename(mailfile)
|
||||||
fpath = os.path.join(self.config.mailfrozen, fname)
|
fpath = os.path.join(self.config.mailfrozen, 'new')
|
||||||
|
fpath = os.path.join(fpath, fname)
|
||||||
if os.path.isfile(mailfile):
|
if os.path.isfile(mailfile):
|
||||||
os.link(mailfile, fpath)
|
os.link(mailfile, fpath)
|
||||||
os.unlink(mailfile)
|
os.unlink(mailfile)
|
||||||
|
txt += 'Moved to %s\n' %fpath
|
||||||
|
self.logger.log_warn(txt)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def process_msg(self, msg):
|
def process_msg(self, msg):
|
||||||
# Check whether one of the lists will take it
|
# Check whether one of the lists will take it
|
||||||
for ml in self.mailinglists:
|
for ml in self.mailinglists:
|
||||||
|
@ -209,8 +213,6 @@ class remaild(object):
|
||||||
policy=self.policy)
|
policy=self.policy)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.move_frozen(mailfile)
|
self.move_frozen(mailfile)
|
||||||
txt = 'Failed to read mail file %s. Moved to frozen\n' %(mailfile)
|
|
||||||
self.logger.log_exception(txt, ex)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
res = self.process_msg(msg)
|
res = self.process_msg(msg)
|
||||||
|
@ -219,9 +221,6 @@ class remaild(object):
|
||||||
os.unlink(mailfile)
|
os.unlink(mailfile)
|
||||||
else:
|
else:
|
||||||
self.move_frozen(mailfile)
|
self.move_frozen(mailfile)
|
||||||
txt = 'Failed to process mail file %s.' %(mailfile)
|
|
||||||
txt += ' Moved to frozen\n.'
|
|
||||||
self.logger.log_warn(txt)
|
|
||||||
|
|
||||||
def process_mails(self):
|
def process_mails(self):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue