diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-11-14 15:49:35 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-11-14 15:49:35 +0100 |
commit | e3a2f4bc1dd624a1e5fa42e0abaf099857f6f4b9 (patch) | |
tree | 0a34b325247a4c148aa312a2ca38ffd32afd594b | |
parent | d7b8db9b96ec6e8c6a3da6a5364ec5b9937533e0 (diff) | |
download | remail-e3a2f4bc1dd624a1e5fa42e0abaf099857f6f4b9.tar.gz |
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>
-rw-r--r-- | remail/remaild.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/remail/remaild.py b/remail/remaild.py index cdc7acf..fad7d37 100644 --- a/remail/remaild.py +++ b/remail/remaild.py @@ -166,15 +166,19 @@ class remaild(object): def move_frozen(self, mailfile): try: + txt = 'Failed to process mail file %s\n' %(mailfile) + self.logger.log_warn(txt) 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): os.link(mailfile, fpath) os.unlink(mailfile) + txt += 'Moved to %s\n' %fpath + self.logger.log_warn(txt) except: pass - def process_msg(self, msg): # Check whether one of the lists will take it for ml in self.mailinglists: @@ -209,8 +213,6 @@ class remaild(object): policy=self.policy) except Exception as ex: self.move_frozen(mailfile) - txt = 'Failed to read mail file %s. Moved to frozen\n' %(mailfile) - self.logger.log_exception(txt, ex) continue res = self.process_msg(msg) @@ -219,9 +221,6 @@ class remaild(object): os.unlink(mailfile) else: 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): ''' |