andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0029-Issue-50873-Fix-issues-with-healthcheck-tool.patch

8394b4
From 717ce8b3b50c7a92cc269836a88c3015d1786120 Mon Sep 17 00:00:00 2001
8394b4
From: Mark Reynolds <mreynolds@redhat.com>
8394b4
Date: Fri, 31 Jan 2020 16:36:28 -0500
8394b4
Subject: [PATCH] Issue 50873 - Fix issues with healthcheck tool
8394b4
8394b4
Description:
8394b4
8394b4
- Wrong error code reported with result for backend check
8394b4
8394b4
- Disk Space Monitor check crashes because it is missing "import copy"
8394b4
8394b4
- On a non-LDAPI instance "dsctl healthcheck" does not prompt for bind dn, only for password.
8394b4
8394b4
relates: https://pagure.io/389-ds-base/issue/50873
8394b4
8394b4
Reviewed by: firstyear(Thanks!)
8394b4
---
8394b4
 src/lib389/lib389/cli_base/__init__.py | 16 ++++++++++------
8394b4
 src/lib389/lib389/lint.py              |  2 +-
8394b4
 src/lib389/lib389/monitor.py           |  1 +
8394b4
 3 files changed, 12 insertions(+), 7 deletions(-)
8394b4
8394b4
diff --git a/src/lib389/lib389/cli_base/__init__.py b/src/lib389/lib389/cli_base/__init__.py
8394b4
index e2e6c902a..7dd45b373 100644
8394b4
--- a/src/lib389/lib389/cli_base/__init__.py
8394b4
+++ b/src/lib389/lib389/cli_base/__init__.py
8394b4
@@ -129,14 +129,18 @@ def connect_instance(dsrc_inst, verbose, args):
8394b4
             # No password or we chose to prompt
8394b4
             dsargs[SER_ROOT_PW] = getpass("Enter password for {} on {}: ".format(dsrc_inst['binddn'], dsrc_inst['uri']))
8394b4
     elif not ds.can_autobind():
8394b4
-        # No LDAPI, prompt for password
8394b4
+        # No LDAPI, prompt for password, and bind DN if necessary
8394b4
+        if dsrc_inst['binddn'] is None:
8394b4
+            dn = ""
8394b4
+            while dn == "":
8394b4
+                dn = input("Enter Bind DN: ")
8394b4
+            dsrc_inst['binddn'] = dn
8394b4
         dsargs[SER_ROOT_PW] = getpass("Enter password for {} on {}: ".format(dsrc_inst['binddn'], dsrc_inst['uri']))
8394b4
 
8394b4
-    if 'binddn' in dsrc_inst:
8394b4
-        # Allocate is an awful interface that we should stop using, but for now
8394b4
-        # just directly map the dsrc_inst args in (remember, dsrc_inst DOES
8394b4
-        # overlay cli args into the map ...)
8394b4
-        dsargs[SER_ROOT_DN] = dsrc_inst['binddn']
8394b4
+    # Allocate is an awful interface that we should stop using, but for now
8394b4
+    # just directly map the dsrc_inst args in (remember, dsrc_inst DOES
8394b4
+    # overlay cli args into the map ...)
8394b4
+    dsargs[SER_ROOT_DN] = dsrc_inst['binddn']
8394b4
 
8394b4
     ds = DirSrv(verbose=verbose)
8394b4
     ds.allocate(dsargs)
8394b4
diff --git a/src/lib389/lib389/lint.py b/src/lib389/lib389/lint.py
8394b4
index 736dffa14..68b729674 100644
8394b4
--- a/src/lib389/lib389/lint.py
8394b4
+++ b/src/lib389/lib389/lint.py
8394b4
@@ -47,7 +47,7 @@ DSBLE0002 = {
8394b4
 }
8394b4
 
8394b4
 DSBLE0003 = {
8394b4
-    'dsle': 'DSBLE0002',
8394b4
+    'dsle': 'DSBLE0003',
8394b4
     'severity': 'LOW',
8394b4
     'items' : [],
8394b4
     'detail' : """The backend database has not been initialized yet""",
8394b4
diff --git a/src/lib389/lib389/monitor.py b/src/lib389/lib389/monitor.py
8394b4
index 290cad5e2..d6413de98 100644
8394b4
--- a/src/lib389/lib389/monitor.py
8394b4
+++ b/src/lib389/lib389/monitor.py
8394b4
@@ -6,6 +6,7 @@
8394b4
 # See LICENSE for details.
8394b4
 # --- END COPYRIGHT BLOCK ---
8394b4
 
8394b4
+import copy
8394b4
 from lib389._constants import *
8394b4
 from lib389._mapped_object import DSLdapObject
8394b4
 from lib389.utils import (ds_is_older)
8394b4
-- 
8394b4
2.21.1
8394b4