#50242 Ticket 50213 - fix list instance issue
Closed by spichugi. Opened by firstyear.
firstyear/389-ds-base 50213-remove  into  master

Download 50242.patch

Bug Description: A format string would not always be created
which caused instance list to fail. This may lead to instance
removal failing (creation and api removal still functioned)

Fix Description: Use a correctly initialised paths object, and
add extra debugging around the list capability for -v

https://pagure.io/389-ds-base/issue/50213

Author: William Brown william@blackhats.net.au

Review by: ???

Sorry it still is not working:

[root@localhost cli]# ./dsctl localhost remove --do-it 
About to remove instance (localhost)!
If this is not what you want, press ctrl-c now ...
5 ...
4 ...
3 ...
2 ...
1 ...
Removing instance ...
Instance configuration not found, no action will be taken
If you want us to cleanup anyway, recreate '/etc/dirsrv/dse.ldif'
Completed instance removal
[root@localhost cli]# ls /etc/dirsrv
config  schema  slapd-localhost  ssca
[root@localhost cli]# ls /etc/dirsrv/slapd-localhost/
18a51399.0  certmap.conf  dse.ldif.startOK  noise.txt   pwdfile.txt  Self-Signed-CA.pem  Server-Cert-Key.pem
ca.crt      dse.ldif      e01bf15d.0        pin.txt     schema       Server-Cert.crt     Server-Cert.pem
cert9.db    dse.ldif.bak  key4.db           pkcs11.txt  schema.bak   Server-Cert.csr     slapd-collations.conf

Show me dsctl -v instance remove --do-it please.

Show me dsctl -v instance remove --do-it please.

Sure:

# ./dsctl -v localhost remove --do-it
DEBUG: The 389 Directory Server Administration Tool
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: Called with: Namespace(ack=True, func=<function instance_remove at 0x7fb78a72f400>, instance='localhost', json=False, list=False, remove_all=False, verbose=True)
DEBUG: Allocate <class 'lib389.DirSrv'> with None
DEBUG: Allocate <class 'lib389.DirSrv'> with b'localhost.localdomain':636
DEBUG: Allocate <class 'lib389.DirSrv'> with b'localhost.localdomain':636
DEBUG: Instance allocated
INFO: 
About to remove instance (localhost)!
If this is not what you want, press ctrl-c now ...
INFO: 5 ...
INFO: 4 ...
INFO: 3 ...
INFO: 2 ...
INFO: 1 ...
INFO: Removing instance ...
DEBUG: Removing instance localhost
DEBUG: Stopping instance localhost
DEBUG: Checking for instance marker at /etc/dirsrv/dse.ldif
INFO: Instance configuration not found, no action will be taken
INFO: If you want us to cleanup anyway, recreate '/etc/dirsrv/dse.ldif'
INFO: Completed instance removal

Looks like in remove.py this needs to be changed:

+      etc_dirsrv_path = os.path.join(dirsrv.ds_paths.sysconf_dir, 'dirsrv/')
-     ssca_path = os.path.join(etc_dirsrv_path, 'ssca/')
+    dse_ldif_path = os.path.join(etc_dirsrv_path, 'dse.ldif')

Should be:

dse_ldif_path = os.path.join(dirsrv.ds_paths.config_dir, 'dse.ldif')

Yeah, I just found it. I'm wondering why it was working for me (may be prefix install vs not)

Yeah, I just found it. I'm wondering why it was working for me (may be prefix install vs not)

Yeah not sure, does this change still work correctly for you?

Testing now and I'll find out. I've added more logging around this area too to make it easier if it happens again ...

rebased onto 130c5e9986c643cbfcca22a60a0eb15228febb1b

I0> sudo -u dirsrv dsctl -v localhost remove --do-it
DEBUG: The 389 Directory Server Administration Tool
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: Called with: Namespace(ack=True, func=<function instance_remove at 0x7f68e049f400>, instance='localhost', json=False, list=False, remove_all=False, verbose=True)
DEBUG: Allocate <class 'lib389.DirSrv'> with None
DEBUG: Allocate <class 'lib389.DirSrv'> with b'ldapkdc.example.com':3636
DEBUG: Allocate <class 'lib389.DirSrv'> with b'ldapkdc.example.com':3636
DEBUG: Instance allocated
INFO:
About to remove instance (localhost)!
If this is not what you want, press ctrl-c now ...
INFO: 5 ...
INFO: 4 ...
INFO: 3 ...
INFO: 2 ...
INFO: 1 ...
INFO: Removing instance ...
DEBUG: Removing instance localhost
DEBUG: Checking for instance marker at /opt/dirsrv/etc/dirsrv/slapd-localhost/dse.ldif
DEBUG: Found instance marker at /opt/dirsrv/etc/dirsrv/slapd-localhost/dse.ldif! Proceeding to remove ...
DEBUG: Stopping instance localhost
DEBUG: Pid of 97836 is not running for localhost
DEBUG: Removing /opt/dirsrv/var/lib/dirsrv/slapd-localhost/bak
DEBUG: Removing /opt/dirsrv/etc/dirsrv/slapd-localhost
DEBUG: Removing /opt/dirsrv/etc/dirsrv/slapd-localhost
DEBUG: Removing /opt/dirsrv/var/lib/dirsrv/slapd-localhost/db
DEBUG: Removing /opt/dirsrv/var/lib/dirsrv/slapd-localhost/db/../
DEBUG: Removing /opt/dirsrv/var/lib/dirsrv/slapd-localhost/changelogdb
DEBUG: Removing /opt/dirsrv/var/lib/dirsrv/slapd-localhost/ldif
DEBUG: Removing /opt/dirsrv/var/lock/dirsrv/slapd-localhost
DEBUG: Removing /opt/dirsrv/var/log/dirsrv/slapd-localhost
DEBUG: Removing /dirsrv-localhost.conf
DEBUG: Removing /opt/dirsrv/lib/dirsrv/slapd-localhost
DEBUG: Removing /opt/dirsrv/etc/sysconfig/dirsrv-localhost
DEBUG: Moving /opt/dirsrv/etc/dirsrv/slapd-localhost to /opt/dirsrv/etc/dirsrv/slapd-localhost.removed
DEBUG: Complete
INFO: Completed instance removal

Fix that, so if this fails again, we'll also get better logging too about the cause.

(I'm curious about this removing /dirsrv-localhost.conf too now, so I'll check that atm)

The current patch works for me, ack! But please if you see any else funny that you want me to test just let me know. Calling it a night though...

I'm fixing that last odd file (it's systemd related), then I'll push the branch, it's rebased and ready to merge.

rebased onto 6963780bd89a37b758799ec390983db5392b596f

Looks good to me.

Pull-Request has been merged by firstyear

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 pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3301

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata