#49779 Ticket 49777 - add config subcommand to dsconf
Closed by spichugi. Opened by mreynolds.
mreynolds/389-ds-base ticket49777  into  master

Download 49779.patch

Description: Added a "config" subcomand to dsconf for getting and
setting cn=config attributes. Also fixed JSON issues.

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

Reviewed by: ?

I think we should also allow a user to delete attribute without specifying the exact attribute value.
Something like:

dsconf -v -D "cn=Directory manager" ldap://localhost:389 config delete passwordMaxAge

Okay, everything works but I have couple suggestions. :)

The debug now is misleading, it doesn't mention the 'action'
So we have something like:

# dsconf -v -D "cn=Directory manager" ldap://localhost:389 config delete passwordMaxAge=1231231
......
INFO: open(): bound as cn=Directory manager
DEBUG: cn=config set('passwordMaxAge', '1231231')
INFO: Success!
INFO: Command successful.
DEBUG: dsconf is brought to you by the letter H and the number 25.

I think we should mention the 'action' in the DEBUG: cn=config set('passwordMaxAge', '1231231') line. You can find the code here:
https://pagure.io/389-ds-base/blob/master/f/src/lib389/lib389/_mapped_object.py#_313

Another thing, I think, we can use wrappers (self.add, self.replace, etc.) instead of 'set()' calls. You can find them here:
https://pagure.io/389-ds-base/blob/master/f/src/lib389/lib389/_mapped_object.py#_235

If we want to delete all attribute values, we can use remove_all.
And if the value was specified - we use remove.

What do you think?

The PR needs a little work, but this is how it "should" work:

dsconf -v -D "cn=Directory manager" ldap://localhost:389 config delete passwordMaxAge=1231231

--> deletes specific value

dsconf -v -D "cn=Directory manager" ldap://localhost:389 config delete passwordMaxAge

--> deletes all passwordMaxAge attributes. This almost works, but it expects a value. So I need to change it

Changes made, please review.

Note - I also add more validation to the "set" operations

rebased onto 39cac9c018136c46c6be4b3899b68d1bcca5c25f

Looks good to me! Ack

rebased onto 5fe4e21ab4e6823dae8b34ed7e84413b70981504

Pull-Request has been merged by mreynolds

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

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