File 0001-Ticket-51161-fix-SLE15.2-install-issps.patch of Package 389-ds.13576

From c7d81c280dc91621c5623cab45efb44028997773 Mon Sep 17 00:00:00 2001
From: William Brown <william@blackhats.net.au>
Date: Thu, 18 Jun 2020 14:01:48 +1000
Subject: [PATCH] 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 <william@blackhats.net.au>

Review by: mreynolds (Thanks!)
---
 src/lib389/lib389/instance/setup.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index 06d904390..fb2b2d946 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -804,7 +804,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"
@@ -831,7 +833,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'],
-- 
2.24.3 (Apple Git-128)

openSUSE Build Service is sponsored by