Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance setup.py uses sysconf_dir with hardcoded path instead of initconfig_dir #3033

Closed
389-ds-bot opened this issue Sep 13, 2020 · 7 comments
Labels
closed: fixed Migration flag - Issue

Comments

@389-ds-bot
Copy link

Cloned from Pagure issue: https://pagure.io/389-ds-base/issue/49974

  • Created at 2018-10-11 18:46:42 by janluca
  • Closed at 2018-11-27 21:19:32 as fixed
  • Assigned to nobody

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'],
@389-ds-bot 389-ds-bot added the closed: fixed Migration flag - Issue label Sep 13, 2020
@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2018-10-12 01:21:21

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

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2018-10-12 01:21:22

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

@389-ds-bot
Copy link
Author

Comment from janluca at 2018-11-16 10:34:42

Is there an update to this topic?

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2018-11-19 22:17:04

@JanLuca Not yet sadly. :( @droideck can you comment on this?

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2018-11-20 01:01:41

Do we have initconfig_dir in defaults.inf? I think that's something we'll need for this patch to really work. @droideck 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)

@389-ds-bot
Copy link
Author

389-ds-bot commented Sep 13, 2020

Comment from spichugi (@droideck) at 2018-11-20 01:51:21

#3092

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2018-11-27 21:19:32

Metadata Update from @droideck:

  • Issue close_status updated to: fixed
  • Issue status updated to: Closed (was: Open)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: fixed Migration flag - Issue
Projects
None yet
Development

No branches or pull requests

1 participant