From fcd6b2e1c5f24ff931ab85448ffa6dffc6ee831f Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Feb 05 2020 14:26:43 +0000 Subject: Issue 50873 - Fix issues with healthcheck tool Description: - Wrong error code reported with result for backend check - Disk Space Monitor check crashes because it is missing "import copy" - On a non-LDAPI instance "dsctl healthcheck" does not prompt for bind dn, only for password. relates: https://pagure.io/389-ds-base/issue/50873 Reviewed by: firstyear(Thanks!) --- diff --git a/src/lib389/lib389/cli_base/__init__.py b/src/lib389/lib389/cli_base/__init__.py index e2e6c90..7dd45b3 100644 --- a/src/lib389/lib389/cli_base/__init__.py +++ b/src/lib389/lib389/cli_base/__init__.py @@ -129,14 +129,18 @@ def connect_instance(dsrc_inst, verbose, args): # No password or we chose to prompt dsargs[SER_ROOT_PW] = getpass("Enter password for {} on {}: ".format(dsrc_inst['binddn'], dsrc_inst['uri'])) elif not ds.can_autobind(): - # No LDAPI, prompt for password + # No LDAPI, prompt for password, and bind DN if necessary + if dsrc_inst['binddn'] is None: + dn = "" + while dn == "": + dn = input("Enter Bind DN: ") + dsrc_inst['binddn'] = dn dsargs[SER_ROOT_PW] = getpass("Enter password for {} on {}: ".format(dsrc_inst['binddn'], dsrc_inst['uri'])) - if 'binddn' in dsrc_inst: - # Allocate is an awful interface that we should stop using, but for now - # just directly map the dsrc_inst args in (remember, dsrc_inst DOES - # overlay cli args into the map ...) - dsargs[SER_ROOT_DN] = dsrc_inst['binddn'] + # Allocate is an awful interface that we should stop using, but for now + # just directly map the dsrc_inst args in (remember, dsrc_inst DOES + # overlay cli args into the map ...) + dsargs[SER_ROOT_DN] = dsrc_inst['binddn'] ds = DirSrv(verbose=verbose) ds.allocate(dsargs) diff --git a/src/lib389/lib389/lint.py b/src/lib389/lib389/lint.py index b2bd8cd..c6f2df3 100644 --- a/src/lib389/lib389/lint.py +++ b/src/lib389/lib389/lint.py @@ -47,7 +47,7 @@ DSBLE0002 = { } DSBLE0003 = { - 'dsle': 'DSBLE0002', + 'dsle': 'DSBLE0003', 'severity': 'LOW', 'items' : [], 'detail' : """The backend database has not been initialized yet""", diff --git a/src/lib389/lib389/monitor.py b/src/lib389/lib389/monitor.py index 283c9fb..cfaacff 100644 --- a/src/lib389/lib389/monitor.py +++ b/src/lib389/lib389/monitor.py @@ -6,6 +6,7 @@ # See LICENSE for details. # --- END COPYRIGHT BLOCK --- +import copy from lib389._constants import * from lib389._mapped_object import DSLdapObject from lib389.utils import (ds_is_older)