]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Get local virtual aliases.
authorFrank Brehm <frank@brehm-online.com>
Tue, 23 May 2023 16:12:08 +0000 (18:12 +0200)
committerFrank Brehm <frank@brehm-online.com>
Tue, 23 May 2023 16:12:08 +0000 (18:12 +0200)
lib/pp_admintools/app/barracuda_sync.py

index 6805d0a52a22883d0f78e0884ea0093030b663c3..071e27532d3e83415e2d7adfb27330ebf0469e96 100644 (file)
@@ -26,7 +26,7 @@ from fb_tools.xlate import format_list
 from .ldap import BaseLdapApplication
 from ..xlate import XLATOR
 
-__version__ = '0.7.0'
+__version__ = '0.7.1'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -330,6 +330,22 @@ class BarracudaSyncApp(BaseLdapApplication):
         """Reading virtual aliases from given file."""
         LOG.info(_("Reading in from virtual alias file {!r} ...").format(str(va_file)))
 
+        handler = BaseHandler(appname=self.appname, verbose=self.verbose)
+        pdata = handler.call([str(self.postmap_command), '-s', str(va_file)], quiet=True)
+
+        if pdata.returncode > 0:
+            msg = _('Error {rc} on getting virtual aliases from {va!r}').format(
+                rc=pdata.returncode, va=str(va_file))
+            if pdata.stderr:
+                msg += ': ' + pdata.stderr
+            else:
+                msg += '.'
+            LOG.err(msg)
+            self.exit(6)
+
+        if self.verbose > 2:
+            LOG.debug(_('Result:') + '\n' + str(pdata))
+
     # -------------------------------------------------------------------------
     def _run(self):