Blame SOURCES/0027-Issue-50823-dsctl-doesn-t-work-with-slapd-in-the-ins.patch

8394b4
From 442b49cc1a0d93122fa749363b5930f3acf2eaf0 Mon Sep 17 00:00:00 2001
8394b4
From: Matus Honek <mhonek@redhat.com>
8394b4
Date: Wed, 29 Jan 2020 14:06:04 +0000
8394b4
Subject: [PATCH] Issue 50823 - dsctl doesn't work with 'slapd-' in the
8394b4
 instance name
8394b4
8394b4
Bug Description:
8394b4
DirSrv.list drops all occurrences of 'slapd-' within a serverid
8394b4
rendering names containing it damaged.
8394b4
8394b4
Fix Description:
8394b4
Remove only the first occurrence of 'slapd-' in the serverid, which is
8394b4
the prefix that is expected to be removed.
8394b4
8394b4
Fixes https://pagure.io/389-ds-base/issue/50823
8394b4
8394b4
Author: Matus Honek <mhonek@redhat.com>
8394b4
8394b4
Review by: Mark, William (thanks!)
8394b4
8394b4
(cherry picked from commit 52930da0bb8abe94a56ff6dca5ea57347d3461a9)
8394b4
---
8394b4
 src/lib389/lib389/__init__.py       | 2 +-
8394b4
 src/lib389/lib389/instance/setup.py | 2 +-
8394b4
 2 files changed, 2 insertions(+), 2 deletions(-)
8394b4
8394b4
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
8394b4
index 0d1ab5747..003b686fa 100644
8394b4
--- a/src/lib389/lib389/__init__.py
8394b4
+++ b/src/lib389/lib389/__init__.py
8394b4
@@ -711,7 +711,7 @@ class DirSrv(SimpleLDAPObject, object):
8394b4
         if serverid is None and hasattr(self, 'serverid'):
8394b4
             serverid = self.serverid
8394b4
         elif serverid is not None:
8394b4
-            serverid = serverid.replace('slapd-', '')
8394b4
+            serverid = serverid.replace('slapd-', '', 1)
8394b4
 
8394b4
         if self.serverid is None:
8394b4
             # Need to set the Paths in case it does exist
8394b4
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
8394b4
index 61ffc32ee..c6bb4fcdc 100644
8394b4
--- a/src/lib389/lib389/instance/setup.py
8394b4
+++ b/src/lib389/lib389/instance/setup.py
8394b4
@@ -219,7 +219,7 @@ class SetupDs(object):
8394b4
         insts = inst.list(serverid=serverid)
8394b4
 
8394b4
         if len(insts) != 1:
8394b4
-            log.error("No such instance to remove {}".format(serverid))
8394b4
+            self.log.error("No such instance to remove {}".format(serverid))
8394b4
             return
8394b4
         inst.allocate(insts[0])
8394b4
         remove_ds_instance(inst, force=True)
8394b4
-- 
8394b4
2.21.1
8394b4