#50498 Issue 50497 - Port cl-dump.pl tool to Python using lib389
Closed by spichugi. Opened by spichugi.
spichugi/389-ds-base cl_dump  into  master

Download 50498.patch

Bug Description: We're going to deprecate all Perl scripts in 389-ds
so cl-dump.pl should be ported as soon as possible.

Fix Description: Put the tool to dsconf replication dump-changelog.
Preserve all the functionality and output format.
Depricate ChangelogLegacy object.
Move Changelog5 object to replica.py so we can avoid import loops.
Also it makes more sense to have it there because it is part of Replication.
Add ChangelogLDIF object.
Add process_and_dump_changelog() method to Replicas object.

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

Reviewed by: ?

Fix npm audit issues. is temporary here for your conviniece, so you can easily build it and test it.

I wonder if we should use a different date format where the Month is spelled out? July 15, 2019 16:11:12 Different countries use different orders for the slash separated date components. So it's best to try to avoid any confusion if possible.

Shouldn't process and dump be a function of Changelog5 instead of implemented outside of it? And then the tool just calls "cl = Changelog5(); cl.process and dump()"?

I think my concern here is that we should not have logic in the CLI framework, because that makes it impossible to reuse for api or tests - perhaps this cl decode should also be in the Changelog5 type?

I wonder if we should use a different date format where the Month is spelled out? July 15, 2019 16:11:12 Different countries use different orders for the slash separated date components. So it's best to try to avoid any confusion if possible.

I agree the "slash" dates are very confusing. I believe we should adhere to ISO 8601 datetimes (ideally with timezone) which follow the principle of having more significant value earlier - easily sortable and parseable and human-comprehensible.

rebased onto 9e379339f6c62fafe069a80fbaafbca376591dcb

Fixed.
Massive changes and rebase with all of the critical master fixes.
Please, review.

rebased onto 7fe69824550581ae2dda450892e960a7532f2912

Looks good to me as well.
Just a doubt about the command (dsconf) and the verb (dump-changelog).
This is not configuration command but rather an admin action like db2ldif, db2back...
Why not implementing this action in dsctl ?
Also instead of dump-changelog, why not something like changelog2ldif ?

Looks good to me as well.
Just a doubt about the command (dsconf) and the verb (dump-changelog).
This is not configuration command but rather an admin action like db2ldif, db2back...
Why not implementing this action in dsctl ?
Also instead of dump-changelog, why not something like changelog2ldif ?

There is a couple of points why I've chosen this approach.

  • dsconf was chosen because we still need credentials to access the directory (we get the changelogdir from there, we run through the list of replicas and we run the CL2LDIF task). dsctl doesn't have the credential's option and it is more of an "offline" tool.
  • dump-changelog was chosen because of the consistency with other names in the replication subcommand. Like we have: create-changelog, delete-changelog, set-changelog, get-changelog.

I am not against changelog2ldif though.
And as @mreynolds was the main developer for replication CLI, I'd give him the final word here, I think... changelog2ldif, dump-changelog or a third funny option.

@spichugi thanks for your answer. I agree with you, being a task it makes sense to add it into dsconf.

For the action verb, I have no strong opinion but the advantage of x2ldif is that it gives indication about the type of the result. I will follow your and @mreynolds decision.

I prefer what Simon has. It matches the surrounding CLI usage: get-changelog, set-changelog, dump-changelog, ... It also matches most of the other dsconf style usage.

But the CLI help text for "dump-changelog" does not mention that it creates an LDIF file. That should be improved.

rebased onto 04208edbd18a818ef6105cbdedaf48b40f54e717

Pull-Request has been merged by spichugi

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

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