From 86b12aeab1de3fda0d0eb851518f7a477bfaa636 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 23 May 2023 18:12:08 +0200 Subject: [PATCH] Get local virtual aliases. --- lib/pp_admintools/app/barracuda_sync.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/pp_admintools/app/barracuda_sync.py b/lib/pp_admintools/app/barracuda_sync.py index 6805d0a..071e275 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.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): -- 2.39.5