Bug 1542492

Summary: dnf plugin used private methods
Product: [oVirt] otopi Reporter: Yedidyah Bar David <didi>
Component: Plugins.packagersAssignee: Yedidyah Bar David <didi>
Status: CLOSED UPSTREAM QA Contact: Barbora Dolezalova <bdolezal>
Severity: high Docs Contact:
Priority: high    
Version: 1.6.2CC: bugs, gdeolive, mblaha, michal.skrivanek, mperina
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-10-05 08:53:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1542482, 2047251, 2121662    
Bug Blocks: 1455452    

Description Yedidyah Bar David 2018-02-06 13:00:53 UTC
Description of problem:

dnf-2 hidden some calls that used to be public, by prepending '_' to them.
otopi uses some of these, and currently works around this change by calling the hidden names. See also bug 1455452.

Using such private methods is a risk - dnf is allowed to drop them anytime, or change their signature or functionality, thus break otopi, and with it, all the tools that use it - including engine-setup, ovirt-host-deploy, etc.

So dnf should expose the functionality of these methods using official ones (see bug 1542482 for that) and then otopi should use these new official ones.

[1] https://bugzilla.redhat.com/showdependencytree.cgi?id=1455452&hide_resolved=0

Comment 1 Yedidyah Bar David 2021-01-18 14:25:22 UTC
113041 removes use of _group_by_id.

Remaining:

- base._plugins._unload - seems to be needed. Need to open a bug on dnf to expose it.

- dnf.__version__ - perhaps OK? dnf's code defines it as: "__version__ = VERSION  # :api". So perhaps it's part of the official API.

- base._history_undo_operations - Does not exist anymore in dnf code, was removed recently in [1]. So we might be broken soon (once [1] is included in EL). Need to either find out how to implement using existing API or open a bug on dnf to expose/document how to do this.

[1] https://github.com/rpm-software-management/dnf/commit/69ce000e433784b5eb70e94ccb1766d5bf878690

Comment 2 Yedidyah Bar David 2021-08-30 07:35:00 UTC
Now got a report [1] about another method - dnf.history.open_history - removed in dnf 3 [2]. This causes rollback, e.g. in engine-setup doing upgrade, to not rollback the packages.

[1] https://lists.ovirt.org/archives/list/users@ovirt.org/thread/EZJTUOHNHKT7YBO222QVLA5VVBXCXZFD/
[2] https://github.com/rpm-software-management/dnf/commit/8198019c0488258be589af3935a1bc579ab29786

Comment 3 RHEL Program Management 2021-08-30 09:24:50 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 7 Yedidyah Bar David 2021-09-02 14:18:47 UTC
Daniel, can you please advise about doing 'dnf history undo' using the API? See comment 2. Can't find anything in the api reference. Thanks.

Comment 8 Yedidyah Bar David 2021-09-05 14:09:05 UTC
(In reply to Yedidyah Bar David from comment #7)
> Daniel, can you please advise about doing 'dnf history undo' using the API?
> See comment 2. Can't find anything in the api reference. Thanks.

I spent some time looking at relevant code and changes in dnf and came up with:

https://gerrit.ovirt.org/c/otopi/+/116476

What do you say?

Comment 9 Yedidyah Bar David 2021-09-12 10:11:24 UTC
Decided to split comment 2 to its own bug 2003441 and reverted the subject.

Comment 10 Yedidyah Bar David 2021-09-12 10:15:10 UTC
Removing needinfo on Daniel, set needinfo on him on the split bug

Comment 12 Yedidyah Bar David 2022-01-12 11:16:38 UTC
Right now, in master branch, if I got it right, the only private things we use from dnf are:

dnf.__version__
base._plugins._unload()

Marek, what do you think?

Should dnf expose these as an official API?
Should I open a bug/issue for this?

If not, what should we do instead?

Thanks.

Comment 13 Marek Blaha 2022-01-27 13:04:27 UTC
Yes, please open a bug for it. Dnf currently has several API functions for plugins (init_plugins, pre_configure_plugins, configure_plugins) so it should be possible to add one for unloading them.
The `__version__` is currently already marked as an API so you can use it.

Comment 14 Yedidyah Bar David 2022-01-27 13:20:19 UTC
Keeping current bug open so that once 2047251 is handled, we can use the replacement provided by it.

Comment 15 Yedidyah Bar David 2022-09-07 09:45:45 UTC
Linked PR 35 uses the new unload_plugins if available, otherwise _plugins._unload.

I am still waiting for the dnf patch to be included in CentOS Stream 9, for verification, and then will merge 35.

Comment 16 Martin Perina 2022-10-05 08:53:22 UTC
Moving to https://github.com/oVirt/otopi/issues/40