]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Completing verifying cmd line parametrers
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 17 May 2023 14:54:27 +0000 (16:54 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 17 May 2023 14:54:27 +0000 (16:54 +0200)
lib/pp_admintools/app/barracuda_sync.py

index e41a97561b0d2fe25e5ff124d2f65b2b633d2967..80185c4e75edc39337722e5ddfaa3c9b946b3292 100644 (file)
@@ -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):