1
0
mirror of https://github.com/OfflineIMAP/offlineimap.git synced 2024-06-26 07:29:03 +02:00

report UID validity problem in exit code

Since skipping a folder means no new data is downloaded, the UID validity
problem is a backup failure. Make it possible to alert or work around
it in scripts by signaling with the exit code.

Signed-off-by: Alex Kapranoff <alex@kapranoff.ru>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Alex Kapranoff 2015-05-05 20:35:37 +03:00 committed by Nicolas Sebrecht
parent c8e5f32eba
commit 07af72081a

View File

@ -65,6 +65,8 @@ class UIBase(object):
self.logfile = None
self.exc_queue = Queue()
# saves all occuring exceptions, so we can output them at the end
self.uidval_problem = False
# at least one folder skipped due to UID validity problem
# create logger with 'OfflineImap' app
self.logger = logging.getLogger('OfflineImap')
self.logger.setLevel(loglevel)
@ -345,6 +347,7 @@ class UIBase(object):
self.logger.info("Skipping %s (not changed)" % folder)
def validityproblem(self, folder):
self.uidval_problem = True
self.logger.warning("UID validity problem for folder %s (repo %s) "
"(saved %d; got %d); skipping it. Please see FAQ "
"and manual on how to handle this."% \
@ -516,6 +519,10 @@ class UIBase(object):
self.warn('ERROR: %s\n\n%s\n'% (errortitle, errormsg))
elif errormsg:
self.warn('%s\n'% errormsg)
if self.uidval_problem:
self.warn('At least one folder skipped due to UID validity problem')
if exitstatus == 0:
exitstatus = 2
sys.exit(exitstatus)
def threadExited(self, thread):