From ba7ad9a4f7d1509fa201d39099af342bbaf67aaf Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Thu, 3 Feb 2022 16:06:07 -0500
Subject: [PATCH] Issue 5142 - CLI - dsctl dbgen is broken

Description:

Changes to dsctl broke dbgen which requires instance.userid to
set the permissions of the ldif file. It occurred when we added:
local_simple_allocate(). The fix is add userid in this allocate
function.

relates: https://github.com/389ds/389-ds-base/issues/5142

Reviewed by: progier(Thanks!)
---
 src/lib389/lib389/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 78430d720e..b8ca7685f5 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -446,6 +446,7 @@ def local_simple_allocate(self, serverid, ldapuri=None, binddn='cn=Directory Man
         self.isLocal = True
         self.ds_paths = Paths(serverid, instance=self, local=self.isLocal)
         self.serverid = serverid
+        self.userid = self.ds_paths.user
 
         # Do we have ldapi settings?
         self.ldapi_enabled = None
@@ -547,7 +548,7 @@ def allocate(self, args):
             self.host = ldapuri_parsed.hostname
             try:
                 self.port = ldapuri_parsed.port
-            except ValueError as e:
+            except ValueError:
                 self.port = DEFAULT_PORT
         else:
             self.host = args.get(SER_HOST, socket.gethostname())
