Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2027835

Summary: RHDS Console cannot load an instance if its DB backup directory doesn't exist.
Product: Red Hat Directory Server Reporter: Têko Mihinto <tmihinto>
Component: cockpit-389-dsAssignee: mreynolds
Status: CLOSED CURRENTRELEASE QA Contact: RHDS QE <ds-qe-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 11.4CC: ldap-maint, mreynolds, pcech, vcech
Target Milestone: DS11.5Keywords: Triaged
Target Release: dirsrv-11.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: redhat-ds-11-8060020220325145233.fd2afb17 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-13 14:44:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Têko Mihinto 2021-11-30 20:33:44 UTC
Description of problem:

RHDS Console will fail to load an instance if the DB backup directory ( nsslapd-bakdir ) is set to a non-existing directory.
The Console will show a spinner and won't allow to select any other RHDS instances.

Version-Release number of selected component (if applicable):
$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.5 (Ootpa)
$
$ rpm -qa | grep 389-ds
389-ds-base-1.4.3.27-2.module+el8dsrv+12690+c6df6d1b.x86_64
389-ds-base-snmp-1.4.3.27-2.module+el8dsrv+12690+c6df6d1b.x86_64
389-ds-base-libs-1.4.3.27-2.module+el8dsrv+12690+c6df6d1b.x86_64
cockpit-389-ds-1.4.3.27-2.module+el8dsrv+12690+c6df6d1b.noarch
$

How reproducible:
Always.

Steps to Reproduce:
1. Set the DB backup directory to a non-existing file:
$ dsconf -D "cn=Directory Manager" ldaps://localhost:1636 config replace nsslapd-bakdir=/DOES_NOT_EXIST
Enter password for cn=Directory Manager on ldaps://localhost:1636: 
Successfully replaced "nsslapd-bakdir"
$
$ dsconf -D "cn=Directory Manager" ldaps://localhost:1636 config get nsslapd-bakdir
Enter password for cn=Directory Manager on ldaps://localhost:1636: 
nsslapd-bakdir: /DOES_NOT_EXIST
$

2. Reload the RHDS Console
3. Select the relevant instance
4. The progress bar goes to 100% but the instance won't be loaded.

Actual results:
Cannot load an instance.

Expected results:
Load the selected RHDS instance.

Additional info:

* JS Console log:
=====================================================
CMD: loadInstanceList: Load the instance list select ==> dsctl -l -j
tools.jsx:58 CMD: setServerId: Test if instance is running  ==> dsctl -j alps9 status
tools.jsx:58 CMD: setServerId: Test if instance is alive  ==> dsconf -j ldapi://%2fvar%2frun%2fslapd-alps9.socket backend suffix list --suffix
tools.jsx:58 CMD: loadBackups: Load Backups ==> dsctl -j alps9 backups
=====================================================

* dsctl verbose output:
=====================================================
# dsctl --verbose -j alps9 backups
DEBUG: The 389 Directory Server Administration Tool
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: Called with: Namespace(delete=None, func=<function dbtasks_backups at 0x7f0e515f26a8>, instance='alps9', json=True, list=False, remove_all=False, verbose=True)
DEBUG: Allocate <class 'lib389.DirSrv'> with None
DEBUG: Allocate <class 'lib389.DirSrv'> with b'alps9.XXX':1636
DEBUG: Allocate <class 'lib389.DirSrv'> with b'alps9.XXX':1636
DEBUG: Instance allocated
DEBUG: [Errno 2] No such file or directory: '/DOES_NOT_EXIST'
Traceback (most recent call last):
  File "/usr/sbin/dsctl", line 142, in <module>
    result = args.func(inst, log, args)
  File "/usr/lib/python3.6/site-packages/lib389/cli_ctl/dbtasks.py", line 65, in dbtasks_backups
    if not inst.backups(args.json):
  File "/usr/lib/python3.6/site-packages/lib389/__init__.py", line 2966, in backups
    dirlist = [item for item in os.listdir(bakdir) if os.path.isdir(os.path.join(bakdir, item))]
FileNotFoundError: [Errno 2] No such file or directory: '/DOES_NOT_EXIST'
{
    "desc": "[Errno 2] No such file or directory: '/DOES_NOT_EXIST'"
}
=====================================================

Comment 2 mreynolds 2021-12-01 12:54:40 UTC
This was fixed in:  https://bugzilla.redhat.com/show_bug.cgi?id=2014924 for RHDS 12.0

This is planned to be backported to RHDS 11.5