Bug 1542492 - dnf plugin used private methods
Summary: dnf plugin used private methods
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: otopi
Classification: oVirt
Component: Plugins.packagers
Version: 1.6.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Yedidyah Bar David
QA Contact: Barbora Dolezalova
URL:
Whiteboard:
Depends On: 1542482 2047251 2121662
Blocks: ovirt-dnf-2.0-support
TreeView+ depends on / blocked
 
Reported: 2018-02-06 13:00 UTC by Yedidyah Bar David
Modified: 2022-10-05 08:53 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-10-05 08:53:22 UTC
oVirt Team: Integration
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github oVirt otopi pull 35 0 None open Minidnf use unload plugins 2022-10-05 08:52:02 UTC
oVirt gerrit 113041 0 master MERGED minidnf: Remove use of private dnf method _group_by_id 2021-02-03 08:58:55 UTC

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


Note You need to log in before you can comment on or make changes to this bug.