#47625 CI lib389: DirSrv not conform to the design
Closed: wontfix None Opened 10 years ago by tbordaz.

This ticket is to do required changes so that DirSrv class conforms to the design http://port389.org/wiki/Upstream_test_framework.

Add methods:

init
allocated
create/delete
list/exists
open/close
start/stop/restart
clearBackupFS/checkBackupFS
backupFS/restoreFS


{{{
# Settings from args of server attributes
364 self.host = args.get(SER_HOST, LOCALHOST) or LOCALHOST
365 self.port = args.get(SER_PORT, DEFAULT_PORT) or DEFAULT_PORT
366 self.sslport = args.get(SER_SECURE_PORT)
367 self.binddn = args.get(SER_ROOT_DN, DN_DM) or DN_DM
368 self.bindpw = args.get(SER_ROOT_PW, PW_DM) or PW_DM
369 self.creation_suffix = args.get(SER_CREATION_SUFFIX, DEFAULT_SUFFIX) or DEFAULT_SUFFIX
}}}

in these cases, the "or PARAM" is redundant - this is exactly what args.get(KEY, PARAM) does. For example, in the call: self.host = args.get(SER_HOST, LOCALHOST) - self.host must be either the value for key SER_HOST, or LOCALHOST. So the "or LOCALHOST" will never be executed. There are other places where this is done.

{{{
self.backupdir = args.get(SER_BACKUP_INST_DIR) or DEFAULT_BACKUPDIR
}}}
I think you mean self.backupdir = args.get(SER_BACKUP_INST_DIR, DEFAULT_BACKUPDIR)

The list method: this doesn't work the way that our other shell scripts/perl scripts work. See ldap/admin/src/scripts/DSSharedLib.in get_initconfig_files() and get_init_file(). Same with the exists() method.

The start method should set self.state = DIRSRV_STATE_ONLINE

list is still not right. I sympathize that it is very confusing.

The main file that should be consulted is the sysconfig file for the instance. This will tell you where the directory containing dse.ldif is. You should not assume the dse.ldif config directory is under $prefix/etc/dirsrv. You should just use the CONFIG_DIR directive in the dirsrv-$inst file. This means you will have to parse the dirsrv-INST file, and keep in mind that the file has two different formats, one for systemd systems, and one for sysv systems.

systemd:
CONFIG_DIR=/home/rich/389-1211/etc/dirsrv/slapd-localhost

sysv:
CONFIG_DIR=/home/rich/389-1211/etc/dirsrv/slapd-localhost ; export CONFIG_DIR

The main driver of where to look is if the user is root or not. If the user is root, then look in $prefix/etc/sysconfig for the dirsrv-INST files. Otherwise, look in $HOME/.dirsrv. In addition, if os.environ['INITCONFIGDIR'] is defined, then only that directory should be used to look for the dirsrv-INST files. This is basically the logic in get_initconfig_files()

Note that it is possible, with a regular FHS (no prefix) system install, for a non-root user to create an instance. In this case, the instance will have a $HOME/.dirsrv/dirsrv-INST file, and the CONFIG_DIR will not be under /etc/dirsrv, it will be in some location writable by the non-root user.

One minor nit: _parse_configfile should skip lines beginning with # - I think the logic will still work, since you will either have

PROP=val

or

PROP=val

but best to just skip commented lines entirely

Otherwise, looks good.

git merge workStandalone
Updating 86ef47f..0ee1bfb
Fast-forward
bug_harness.py | 3 +-
lib389/init.py | 818 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
lib389/_constants.py | 36 +++++
lib389/properties.py | 56 ++++++++
lib389/tools.py | 37 +++--
lib389/utils.py | 50 +++----
tests/dirsrv_test.py | 206 +++++++++++++++++++++++++++
7 files changed, 1109 insertions(+), 97 deletions(-)
create mode 100644 lib389/properties.py
create mode 100644 tests/dirsrv_test.py

git push origin master

Counting objects: 19, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 12.33 KiB, done.
Total 11 (delta 7), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/lib389.git/
86ef47f..0ee1bfb master -> master

commit 0ee1bfba2f75ad9e78d756a2f73b741caa8e57c4
Author: Thierry bordaz (tbordaz) tbordaz@redhat.com
Date: Tue Dec 10 16:41:36 2013 +0100

Milestone lib389 1.0 deleted

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/962

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