From: Frank Brehm Date: Tue, 23 May 2023 15:52:43 +0000 (+0200) Subject: Checking virtual alias files. X-Git-Tag: 0.9.0~1^2~38 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=b490fbe6a5b3d86c7f28a463a8576e7c80ee0cdd;p=pixelpark%2Fpp-admin-tools.git Checking virtual alias files. --- diff --git a/lib/pp_admintools/app/barracuda_sync.py b/lib/pp_admintools/app/barracuda_sync.py index 7d02519..6cb6642 100644 --- a/lib/pp_admintools/app/barracuda_sync.py +++ b/lib/pp_admintools/app/barracuda_sync.py @@ -26,7 +26,7 @@ from fb_tools.xlate import format_list from .ldap import BaseLdapApplication from ..xlate import XLATOR -__version__ = '0.6.4' +__version__ = '0.6.5' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -292,6 +292,29 @@ class BarracudaSyncApp(BaseLdapApplication): """Check existence of given .""" LOG.debug(_('Checking all available virtual aliases table files ...')) + db_extension = self.postfix_filetype_extensions[self.postfix_db_hashtype] + if self.verbose > 1: + LOG.debug(_("Using file extension for db-files: {!r}.").format(db_extension)) + + for va_file in self.virtaliases_files: + db_file = va_file.parent / (va_file.name + db_extension) + if not db_file.exists() or not db_file.is_file(): + LOG.error(_( + "DB file for virtual aliases {!r} does not exists or is not a regular " + "file.").format(str(db_file))) + self.virtaliases_files.remove(va_file) + continue + mtime_db_file = db_file.stat().st_mtime + mtime_va_file = va_file.stat().st_mtime + if mtime_db_file < mtime_va_file: + LOG.warn(_( + "The last modification time of {db!r} is older than this " + "of {va!r}.").format(db=str(db_file), va=str(va_file))) + elif self.verbose > 1: + LOG.debug(_( + "The last modification time of {db!r} and {va!r} are " + "okay.").format(db=str(db_file), va=str(va_file))) + # ------------------------------------------------------------------------- def _run(self):