Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1980712

Summary: dnf --enableplugin and --disableplugin issues
Product: Red Hat Enterprise Linux 8 Reporter: Peter Ajamian <peter>
Component: dnfAssignee: Jan Kolarik <jkolarik>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: low Docs Contact:
Priority: low    
Version: 8.4CC: james.antill, jkolarik, jrohel, mbanas, tbajer
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-4.7.0-13.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2121664 (view as bug list) Environment:
Last Closed: 2023-05-16 09:06:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2121664    

Description Peter Ajamian 2021-07-09 11:01:44 UTC
Description of problem:

For plugins with a name of *-manager (config-manager, groups-manager) dnf --disableplugin and dnf --enableplugin shows an error message when that plugin name is specified explicitly.  Also --disableplugin in this instance fails to disable the plugin.

Version-Release number of selected component (if applicable):
dnf-4.4.2-11.el8.noarch

How reproducible:
Always

Steps to Reproduce:

dnf --disableplugin=config-manager shows an error message and fails to disable the plugin:

[root@rhel8 ~]# dnf --disableplugin=config-manager updateinfo -v
No matches found for the following disable plugin patterns: config-manager
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
...

The above issue can be worked around by replacing the "-" in the plugin name with a wildcard:

[root@rhel8 ~]# dnf --disableplugin=config\?manager updateinfo -v
Loaded plugins: builddep, changelog, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile

For the next tests we explicitly disable config-manager in the plugin config and verify that the plugin has indeed been disabled:

[root@rhel8 ~]# printf '%s\n' '[main]' 'enabled=0' > /etc/dnf/plugins/config-manager.conf
[root@rhel8 ~]# dnf updateinfo -v
Loaded plugins: builddep, changelog, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile

Now attempting to enable the plugin with --enableplugin=config-manager shows an error message, but still works in this case:

[root@rhel8 ~]# dnf --enableplugin=config-manager updateinfo -v
No matches found for the following enable plugin patterns: config-manager
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile

And similarly to before, if the "-" is replaced with a wildcard the error message goes away:

[root@rhel8 ~]# dnf --enableplugin=config\?manager updateinfo -v
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile

Expected results:

No error message, and the plugin should actually be disabled in the case of --disableplugin.

Additional info:

This is a very minor issue with easy workarounds, but nontheless a bug which should be looked into and fixed.  for --enableplugin there is no workaround necessary, the error message is harmless and the setting still works to enable the plugin.  For --disableplugin it is necessary to replace the dash with a wildcard, "?" is recommended.

I have also attempted actual operations with the config-manager plugin and it works consistent with the above (when config-manager is shown in the "Loaded plugins" output the plugin works and it does not work when it is not shown.

Comment 1 Jaroslav Rohel 2021-07-12 14:14:09 UTC
The problem is inconsistency between the plugin name and name of the command implemented by the plugin. Commands usually use "-" in the name, but always "_" in the plugin name.
Eg. the "config-manager" command is implemented in the "config_manager" plugin.
So, to its disabling `--disableplugin=config_manager` is required.

Comment 2 Peter Ajamian 2021-07-15 06:39:29 UTC
This is really confusing, especially when you look at the list of "Loaded plugins" in the dnf -v ... output.  "config-manager" is shown with a dash, but the actual plugin name has an underscore.  "debuginfo-install" is shown with a dash and the actual plugin name actually has a dash.  "generate_completion_cache" is shown with underscores, and the actual plugin name is with underscores.  The fact that --enableplugin=config-manager actually works to enable the plugin, despite outputting an error adds further to the confusion.

Given the above, and that all the documentation seems to refer to the "command name" and not the actual plugin name that is needed for disablerepo or enablerepo, how is one supposed to know, barring trial and error, what the actual plugin name is?  Also the docs could be way clearer in this respect.

I would venture to say that things would be way clearer, and way easier, if the plugin name and command name always matched, as a guideline.

Comment 3 Peter Ajamian 2021-07-18 04:34:41 UTC
...also: what exactly *is* displayed in the dnf -v ... output?  It's obviously not the plugin name, so is it the command name, or some sort of display name or ???  Can the --enableplugin and --disableplugin options be fixed to accept these names as aliases to the plugin name?

Comment 4 Jaroslav Mracek 2022-07-19 10:53:42 UTC
We consider the bug as a valid but because the issue has limited impact (low priority) we postpone the issue in favor of other issues.

Comment 5 Peter Ajamian 2022-07-19 11:46:14 UTC
Thanks for the update, I do appreciate that it's low priority.

Would it be appropriate to push the bug to the upstream project and just let the fix filter down to Fedora and eventually RHEL when it rebases?

Comment 6 Jan Kolarik 2022-08-10 16:38:46 UTC
New implementation will support passing the actual plugin name to the --disableplugin and --enableplugin parameters and also the current way using the underscores is supported.

Comment 7 Jan Kolarik 2022-08-10 16:39:20 UTC
Following PRs were queued to fix this:

fix:   https://github.com/rpm-software-management/dnf/pull/1839
tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/1141

Comment 8 Peter Ajamian 2022-08-11 00:00:19 UTC
Thanks Jan I think that will work great!

I'll try applying that patch against my version of dnf and make sure it fixes the issue, I'll get back to you with the results.

One comment on the tests, I think that the test to enable the plugin should make sure that the plugin is disabled first, otherwise the test doesn't really know if it's really been enabled or not.

Comment 9 Jan Kolarik 2022-08-11 05:25:41 UTC
You're right Peter about the tests. I was focused on the unknown plugin message which works also in this case, but the tests should also check the actual enabling as well. I'll fix that.

Comment 10 Peter Ajamian 2022-08-11 05:54:11 UTC
I can confirm that in both EL8 and EL9 (Tested against Rocky Linux this time) if I apply the patch directly to plugin.py from the python3-dnf package that it fixes the issue:

https://github.com/rpm-software-management/dnf/commit/a7b22adceb2780e8668b0e9b193ff641df660c77.diff

Will we see this applied to the RHEL 8 and RHEL 9 dnf?  I'm okay living with this minor bug but it would be nice to have it fixed in the current releases of RHEL.


Peter

Comment 11 Jan Kolarik 2022-08-23 11:07:34 UTC
(In reply to Peter Ajamian from comment #10)
> I can confirm that in both EL8 and EL9 (Tested against Rocky Linux this
> time) if I apply the patch directly to plugin.py from the python3-dnf
> package that it fixes the issue:
> 
> https://github.com/rpm-software-management/dnf/commit/
> a7b22adceb2780e8668b0e9b193ff641df660c77.diff
> 
> Will we see this applied to the RHEL 8 and RHEL 9 dnf?  I'm okay living with
> this minor bug but it would be nice to have it fixed in the current releases
> of RHEL.
> 
> 
> Peter

Yes, we are planning to deliver the fix into RHEL 8.8 and 9.2. Sorry for the late response, I needed to confirm this information.

Comment 12 Jan Kolarik 2022-08-26 07:10:01 UTC
Cloned into RHEL 9 ticket https://bugzilla.redhat.com/show_bug.cgi?id=2121664.

Comment 13 Peter Ajamian 2022-08-26 07:48:06 UTC
(In reply to Jan Kolarik from comment #11)
> Yes, we are planning to deliver the fix into RHEL 8.8 and 9.2. Sorry for the
> late response, I needed to confirm this information.

That's great, thanks!

Comment 22 errata-xmlrpc 2023-05-16 09:06:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2980