From b59faa43518613e2f0a893c5a7491e1801d8be5b Mon Sep 17 00:00:00 2001 From: William Brown Date: Jun 19 2020 01:24:10 +0000 Subject: Ticket 51161 - fix SLE15.2 install issps Bug Description: On SLE15.2 the hostname is almost always set incorrectly which can break the install. Newer versions of systemd encode utf8 in their command output that trips up the log subsystem. Fix Description: We have to set SER_HOST rather than using the default which is socket.gethostname() from init.py. Discard the special utf8 encodings in the log output for systemd https://pagure.io/389-ds-base/issue/51161 Author: William Brown Review by: mreynolds (Thanks!) --- diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py index bc8c6e7..418b71b 100644 --- a/src/lib389/lib389/instance/setup.py +++ b/src/lib389/lib389/instance/setup.py @@ -805,7 +805,9 @@ class SetupDs(object): args = ' '.join(ensure_list_str(result.args)) stdout = ensure_str(result.stdout) stderr = ensure_str(result.stderr) - self.log.debug(f"CMD: {args} ; STDOUT: {stdout} ; STDERR: {stderr}") + # Systemd encodes some odd charecters into it's symlink output on newer versions which + # can trip up the logger. + self.log.debug(f"CMD: {args} ; STDOUT: {stdout} ; STDERR: {stderr}".encode("utf-8")) # Setup tmpfiles_d tmpfile_d = ds_paths.tmpfiles_d + "/dirsrv-" + slapd['instance_name'] + ".conf" @@ -832,7 +834,16 @@ class SetupDs(object): if self.containerised: ds_instance.systemd_override = general['systemd'] + # By default SUSE does something extremely silly - it creates a hostname + # that CANT be resolved by DNS. As a result this causes all installs to + # fail. We need to guarantee that we only connect to localhost here, as + # it's the only stable and guaranteed way to connect to the instance + # at this point. + # + # Alternately, we could use ldapi instead, which would prevent the need + # to configure a temp root pw in the setup phase. args = { + SER_HOST: "localhost", SER_PORT: slapd['port'], SER_SERVERID_PROP: slapd['instance_name'], SER_ROOT_DN: slapd['root_dn'],