Bug 2167746

Summary: Creation of a new instance fails when using custom directories.
Product: Red Hat Directory Server Reporter: Têko Mihinto <tmihinto>
Component: 389-ds-baseAssignee: LDAP Maintainers <idm-ds-dev-bugs>
Status: NEW --- QA Contact: LDAP QA Team <idm-ds-qe-bugs>
Severity: medium Docs Contact: Evgenia Martynyuk <emartyny>
Priority: high    
Version: 11.6CC: abobrov, idm-ds-dev-bugs, jpetrini, mreynolds, musoni, progier, vashirov
Target Milestone: DS12.3Keywords: Triaged
Target Release: dirsrv-12.3   
Hardware: x86_64   
OS: Linux   
Whiteboard: sync-to-jira
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 2023-02-07 12:49:05 UTC
Description of problem:
Cannot create a new RHDS instance when using custom directories.

Version-Release number of selected component (if applicable):
$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.7 (Ootpa)
$
$ rpm -qa | grep 389-ds
389-ds-base-1.4.3.31-11.module+el8dsrv+17815+4f95348d.x86_64
389-ds-base-libs-1.4.3.31-11.module+el8dsrv+17815+4f95348d.x86_64
cockpit-389-ds-1.4.3.31-11.module+el8dsrv+17815+4f95348d.noarch
$

How reproducible:
Always.

Steps to Reproduce:
1. Generate the installation file
2. Edit the installation file to use custom directories.
For instance:
$ grep "_dir = " /var/tmp/instance.inf
backup_dir = /var/tmp/ldap_server/bak/dirsrv/slapd-{instance_name}/bak
config_dir = /var/tmp/ldap_server/slapd-{instance_name}
db_dir = /var/tmp/ldap_server/slapd-{instance_name}/db
$

3. Try to create the new instance:
$ dscreate --verbose from-file /var/tmp/instance.inf
...
DEBUG: PASSED: network avaliability checking
DEBUG: READY: Beginning installation for test...
DEBUG: ACTION: Creating dse.ldif
INFO: Create file system structures ...
DEBUG: ACTION: creating /var/tmp/ldap_server/bak/dirsrv/slapd-test/bak
DEBUG: ACTION: creating /etc/dirsrv/slapd-test
DEBUG: ACTION: creating /var/tmp/ldap_server/slapd-test/db
DEBUG: ACTION: creating /dev/shm/slapd-test
DEBUG: ACTION: creating /var/lib/dirsrv/slapd-test/ldif
DEBUG: ACTION: creating /run/lock/dirsrv/slapd-test
DEBUG: ACTION: creating /var/log/dirsrv/slapd-test
DEBUG: ACTION: creating /run/dirsrv
DEBUG: b'CMD: systemctl enable dirsrv@test ; STDOUT:  ; STDERR: '
DEBUG: ACTION: Creating certificate database is /etc/dirsrv/slapd-test
DEBUG: Allocate <class 'lib389.DirSrv'> with None
DEBUG: Allocate <class 'lib389.DirSrv'> with /run/slapd-test.socket
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost:41389
DEBUG: Allocate <class 'lib389.DirSrv'> with localhost:41389
DEBUG: list() test instance not found: missing /etc/dirsrv/slapd-test/dse.ldif

DEBUG: Instance failed to install, does not exist when expected
Traceback (most recent call last):
  File "/usr/sbin/dscreate", line 84, in <module>
    result = args.func(inst, log, args)
  File "/usr/lib/python3.6/site-packages/lib389/cli_ctl/instance.py", line 68, in instance_create
    if sd.create_from_inf(args.file):
  File "/usr/lib/python3.6/site-packages/lib389/instance/setup.py", line 540, in create_from_inf
    self.create_from_args(general, slapd, backends, self.extra)
  File "/usr/lib/python3.6/site-packages/lib389/instance/setup.py", line 676, in create_from_args
    self._install_ds(general, slapd, backends)
  File "/usr/lib/python3.6/site-packages/lib389/instance/setup.py", line 885, in _install_ds
    assert_c(ds_instance.exists(), "Instance failed to install, does not exist when expected")
  File "/usr/lib/python3.6/site-packages/lib389/utils.py", line 1274, in assert_c
    raise AssertionError(msg)
AssertionError: Instance failed to install, does not exist when expected
ERROR: Error: Instance failed to install, does not exist when expected
$

Actual results:
Failure to create a new instance.
Despite setting the config_dir to /var/tmp/ldap_server/slapd-{instance_name},
the installer tries to use the default value ( /etc/dirsrv/slapd-{instance_name} ).

Expected results:
The custom directories should be used.

Additional info: