#49974 Instance setup.py uses sysconf_dir with hardcoded path instead of initconfig_dir
Closed: wontfix 5 years ago Opened 5 years ago by janluca.

Issue Description

In lib389/instances/setup.py the _install_ds method of class SetupDs uses sysconf_dir with hardcoded path sysconfig instead of initconfig_dir. This breaks the script if initconfig_dir is not equal to /etc/sysconfig, e.g. /etc/default.

A patch fixing the problem is attached below.

Package Version and Platform

Version: 1.4.0.18
Platfrom: Linux (Debian)

Steps to reproduce

  1. Build 389-ds-base on a system without directory /etc/sysconfig existing at build time. Then initconfig_dir will not be /etc/sysconfig but /etc/default or /etc/$PACKAGE_NAME/config (see configure.ac).
  2. Try to install an instance using dscreate either interactive or from file.

Actual results

Installation fails due to assert condition ds_instance.exists() in method _install_ds of class SetupDs, because ds_instance.list() returning an empty list since sysconfig_head searches for files in /etc/default but the files it is looking for reside in /etc/sysconfig

Expected results

Instance installation works with files installed in directory /etc/default and successful assertion.

diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index 9335613da..9276f1732 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -593,10 +593,10 @@ class SetupDs(object):
             for line in template_init.readlines():
                 initconfig += line.replace('{{', '{', 1).replace('}}', '}', 1).replace('-', '_')
         try:
-            os.makedirs("%s/sysconfig" % slapd['sysconf_dir'], mode=0o775)
+            os.makedirs("%s" % slapd['initconfig_dir'], mode=0o775)
         except FileExistsError:
             pass
-        with open("%s/sysconfig/dirsrv-%s" % (slapd['sysconf_dir'], slapd['instance_name']), 'w') as f:
+        with open("%s/dirsrv-%s" % (slapd['initconfig_dir'], slapd['instance_name']), 'w') as f:
             f.write(initconfig.format(
                 SERVER_DIR=slapd['lib_dir'],
                 SERVERBIN_DIR=slapd['sbin_dir'],

Do we have initconfig_dir in defaults.inf? I think that's something we'll need for this patch to really work. @spichugi Can you follow up with this?

Metadata Update from @firstyear:
- Custom field component adjusted to None
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None
- Custom field type adjusted to None
- Custom field version adjusted to None

5 years ago

Is there an update to this topic?

@janluca Not yet sadly. :( @spichugi can you comment on this?

Do we have initconfig_dir in defaults.inf? I think that's something we'll need for this patch to really work. @spichugi Can you follow up with this?

Looks like we have it. I'll prepare the PR and we can tested on RHEL 7 too (shouldn't be a problem though)

Metadata Update from @spichugi:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

5 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/3033

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: fixed)

3 years ago

Login to comment on this ticket.

Metadata