From 807b27af6aad7caca5e419e9803f7695dd8e3bb5 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 19 Jun 2020 15:13:06 +0200 Subject: [PATCH] Ensuring existence of postfix files on the webserver. --- lib/cr_vmware_tpl/cobbler.py | 25 +++++++++++++++++++++---- lib/cr_vmware_tpl/handler.py | 3 ++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/cr_vmware_tpl/cobbler.py b/lib/cr_vmware_tpl/cobbler.py index 4590aec..2349dcc 100644 --- a/lib/cr_vmware_tpl/cobbler.py +++ b/lib/cr_vmware_tpl/cobbler.py @@ -40,7 +40,7 @@ from .config import CrTplConfiguration from .xlate import XLATOR -__version__ = '0.5.9' +__version__ = '0.5.10' LOG = logging.getLogger(__name__) @@ -761,8 +761,7 @@ class Cobbler(BaseHandler): docroot = self.config.cobbler_ws_docroot / self.config.cobbler_ws_rel_filesdir remote_dir = docroot / self.config.system_status / 'repos' - LOG.info(_("Ensuring currentness of snippets below {!r}.").format( - str(self.config.snippets_dir))) + LOG.info(_("Ensuring currentness of repo files below {!r}.").format(str(files_dir))) for local_repo_dir in files_dir.glob('repos-*'): if not local_repo_dir.is_dir(): @@ -775,7 +774,25 @@ class Cobbler(BaseHandler): self.ensure_remote_directory(remote_dir_os) for local_repo_file in local_repo_dir.glob('*.repo'): remote_file = remote_dir_os / local_repo_file.name - self.ensure_remote_file(local_repo_file, remote_file) + self.ensure_remote_file(local_repo_file, remote_file, check_parent=False) + + LOG.debug(_("Finished with repo files.")) + + # ------------------------------------------------------------------------- + def ensure_postfix_files(self): + + files_dir = self.base_dir / 'files' / 'postfix' + docroot = self.config.cobbler_ws_docroot / self.config.cobbler_ws_rel_filesdir + remote_dir = docroot / self.config.system_status / 'postfix' + + LOG.info(_("Ensuring currentness of postfix files below {!r}.").format(str(files_dir))) + + self.ensure_remote_directory(remote_dir) + for local_file in files_dir.('*'): + remote_file = remote_dir / local_file.name + self.ensure_remote_file(local_file, remote_file, check_parent=False) + + LOG.debug(_("Finished with postfix files.")) # ------------------------------------------------------------------------- def get_dhcp_ip(self, mac_address): diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 38c37fe..98113ac 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -42,7 +42,7 @@ from .cobbler import CobblerError, Cobbler from .xlate import XLATOR -__version__ = '1.6.4' +__version__ = '1.6.5' LOG = logging.getLogger(__name__) TZ = pytz.timezone('Europe/Berlin') @@ -235,6 +235,7 @@ class CrTplHandler(BaseHandler): self.cobbler.ensure_repo_files() self.cobbler.ensure_bashrc() self.cobbler.ensure_create_motd() + self.cobbler.ensure_postfix_files() self.vsphere.get_about() self.vsphere.get_clusters() -- 2.39.5