From c287f626a34756761ce69ce15cbc7f55aa6c19cd Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 17 May 2023 16:54:27 +0200 Subject: [PATCH] Completing verifying cmd line parametrers --- lib/pp_admintools/app/barracuda_sync.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/pp_admintools/app/barracuda_sync.py b/lib/pp_admintools/app/barracuda_sync.py index e41a975..80185c4 100644 --- a/lib/pp_admintools/app/barracuda_sync.py +++ b/lib/pp_admintools/app/barracuda_sync.py @@ -25,7 +25,7 @@ from fb_tools.xlate import format_list from .ldap import BaseLdapApplication from ..xlate import XLATOR -__version__ = '0.6.2' +__version__ = '0.6.3' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -57,6 +57,8 @@ class BarracudaSyncApp(BaseLdapApplication): 'sdbm': '.pag', } + usable_postfix_hashtypes = ['btree', 'cdb', 'dbm', 'hash', 'lmdb', 'sdbm', 'texthash'] + default_ignore_aliases = ['root', ] default_origin = 'pixelpark.com' @@ -96,6 +98,7 @@ class BarracudaSyncApp(BaseLdapApplication): self.postmap_command = Path('/sbin') / self.default_postmap_command self.lookup_table_types = [] + self.virtaliases_files = [] self.existing_aliases = [] self.ldap_aliases = [] self.aliases_to_create = [] @@ -223,6 +226,23 @@ class BarracudaSyncApp(BaseLdapApplication): LOG.error(msg) self.exit(1) self.postfix_db_hashtype = htype + elif self.postfix_db_hashtype not in self.lookup_table_types: + msg = _('Default lookup table type {!r} is invalid. Valid types are:').format( + self.postfix_db_hashtype) + LOG.error(msg) + self.exit(6) + + if self.args.hashtype not in self.usable_postfix_hashtypes: + msg = _( + 'The lookup table type {!r} cannot be used to get all ' + 'database elements.').format(self.postfix_db_hashtype) + LOG.error(msg) + self.exit(6) + + # ------------------------------------------------------------------------- + def _init_virtaliases_files(self): + """Collect all files used as database for virtual aliases.""" + pass # ------------------------------------------------------------------------- def _check_virtaliases_files(self): -- 2.39.5