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

Removed update_from_dict function from ldapupdate #84

Closed
wants to merge 1 commit into from

Conversation

stlaz
Copy link
Contributor

@stlaz stlaz commented Sep 15, 2016

update_from_dict was basically dead code as it's used nowhere in
the project.

https://fedorahosted.org/freeipa/ticket/6311

@abbra
Copy link
Contributor

abbra commented Sep 15, 2016

NACK. Please instead fix update_from_dict() to follow _run_updates() expectations.

update_from_dict() is a handy function for externally provided FreeIPA modules. They will need to implement the same functionality if they would want to do dynamic updates themselves. Thus, the function is better to stay to avoid duplication and instead be fixed to properly call _run_updates().

@MartinBasti
Copy link
Contributor

Shouldn't external plugins use update files or update plugins as IPA does?

We don't have any guaranteed internal API for anything, we don't have any document about external plugins, we don't have prepared any API for 3rd party plugins. We just have your POC 3rd party plugin.

Unless there is no design document with serious investigation and agreed workflow how to work with 3rd party plugins, provided stable well tested API for 3rd party plugins (not just internal API that may and will change), then "is a handy" is not valid argument for me.

I don't remember that we did freeze our internal API, so 3rd party plugins will fail with any change there.

@abbra
Copy link
Contributor

abbra commented Sep 15, 2016

Update plugins are higher level of abstraction. They use ipaserver.install.ldapupdate.LDAPUpdate which provides both .update() and .update_from_dict() methods. Update plugins can produce dictionaries. With the change in this pull request they will have to always write down dynamic update content to files first and then run LDAPUpdate.update() with those files. Or re-implement .update_from_dict().

That's why I gave a NACK -- consider this coming from the work I'm doing right now to create documentation for external plugins. It is silly to remove function only to introduce it back.

@stlaz
Copy link
Contributor Author

stlaz commented Sep 15, 2016

Well, I did fix the test, then. I can imagine the function being pretty handy as a library function although it'd better be used in the future.
What infuriates me is the fact that the test might have never worked (well, at least year and a half, but my guess is never) and nobody really cared.

@rcritten
Copy link
Contributor

For the record this test used to pass. Don't blame the test when the code it is testing was changed.

@MartinBasti MartinBasti changed the title Removed update_from_dict function from ldapupdate Fix update_from_dict function testing Sep 21, 2016
@MartinBasti MartinBasti self-assigned this Sep 21, 2016
@HonzaCholasta
Copy link
Contributor

@abbra:

Update plugins are higher level of abstraction. They use ipaserver.install.ldapupdate.LDAPUpdate which provides both .update() and .update_from_dict() methods. Update plugins can produce dictionaries. With the change in this pull request they will have to always write down dynamic update content to files first and then run LDAPUpdate.update() with those files. Or re-implement .update_from_dict().

This is not true, update plugins are supposed to return the dictionaries from their execute method. See any of the update plugins in ipaserver/install/plugins for how it's done.

@rcritten
Copy link
Contributor

The sort of pie-in-the-sky thinking about 3rd party plugins that Jason and I talked about eons ago was users would provide their own update files as part of their installer to be dropped somewhere (perhaps into the IPA-provided directory) and be processed like any other. I'm not sure I'd want a 3rd party plugin poking at ldapupdate internals.

@abbra
Copy link
Contributor

abbra commented Sep 21, 2016

This is not true, update plugins are supposed to return the dictionaries from their execute method. See any of the update plugins in ipaserver/install/plugins for how it's done.

most of plugins there use direct 'ldap.update()' calls and return empty lists of dictionaries. Perhaps, 'update_uniqueness.py' and 'rename_managed.py' could serve as examples where a list of dictionaries is returned to do the update. But point is taken -- I think this proves we can remove the method as the original patch proposed.

update_from_dict() method is not used anywhere in the project,
it only makes the tests fail. Removed it and its tests.

https://fedorahosted.org/freeipa/ticket/6311
@stlaz
Copy link
Contributor Author

stlaz commented Sep 22, 2016

Removed the method and its respective test again.

@MartinBasti MartinBasti changed the title Fix update_from_dict function testing Removed update_from_dict function from ldapupdate Sep 22, 2016
@abbra
Copy link
Contributor

abbra commented Sep 22, 2016

LGTM. Thanks.

@abbra abbra added the ack Pull Request approved, can be merged label Sep 22, 2016
@MartinBasti MartinBasti added the pushed Pull Request has already been pushed label Sep 22, 2016
@stlaz stlaz deleted the trac-6311 branch July 7, 2017 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
5 participants