From 439cd3810e56a87f803b4a5a644735ecc658d1b8 Mon Sep 17 00:00:00 2001 From: William Brown Date: Mar 10 2020 23:11:17 +0000 Subject: Ticket 50935 - systemd override in lib389 for dscontainer Bug Description: A change to how with_systemd works has caused dscontainer to no longer be able to setup instances, as with_systemd always evals to true from defaults.inf as the marker file isn't written yet - post setup this works. Fix Description: To resolve this, a systemd override is required, that allows the setup to ignore the systemd status as the external tools "know better" than defaults inf up to that point. Post install, this works as the marker would be inplace. https://pagure.io/389-ds-base/issue/50935 Author: William Brown Review by: ??? --- diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py index c77c5a5..44cabdb 100644 --- a/src/lib389/lib389/__init__.py +++ b/src/lib389/lib389/__init__.py @@ -405,8 +405,8 @@ class DirSrv(SimpleLDAPObject, object): # We can't assume the paths state yet ... self.ds_paths = Paths(instance=self, local=False) # Set the default systemd status. This MAY be overidden in the setup utils - # as required. - # self.systemd = self.ds_paths.with_systemd + # as required, generally for containers. + self.systemd_override = None # Reset the args (py.test reuses the args_instance for each test case) # We allocate a "default" prefix here which allows an un-allocate or @@ -1721,6 +1721,8 @@ class DirSrv(SimpleLDAPObject, object): return self.ds_paths.asan_enabled def with_systemd(self): + if self.systemd_override is not None: + return self.systemd_override return self.ds_paths.with_systemd def get_server_tls_subject(self): diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py index 555c8e7..0a3daed 100644 --- a/src/lib389/lib389/instance/setup.py +++ b/src/lib389/lib389/instance/setup.py @@ -811,14 +811,15 @@ class SetupDs(object): # Create certdb in sysconfidir self.log.debug("ACTION: Creating certificate database is %s", slapd['cert_dir']) - # BELOWE THIS LINE - all actions are now ONLINE changes to the directory server. + # BELOW THIS LINE - all actions are now ONLINE changes to the directory server. # if it all possible, ALWAYS ADD NEW INSTALLER CHANGES AS ONLINE ACTIONS. # Should I move this import? I think this prevents some recursion from lib389 import DirSrv ds_instance = DirSrv(self.verbose) - # if self.containerised: - # ds_instance.systemd = general['systemd'] + if self.containerised: + ds_instance.systemd_override = general['systemd'] + args = { SER_PORT: slapd['port'], SER_SERVERID_PROP: slapd['instance_name'],