Bug 1727882 - yum-config-manager cannot update repos on RHEL8
Summary: yum-config-manager cannot update repos on RHEL8
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: yum
Version: 8.4
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: 8.0
Assignee: Jaroslav Rohel
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-08 12:51 UTC by Aleksandar Kostadinov
Modified: 2020-06-22 14:47 UTC (History)
6 users (show)

Fixed In Version: dnf-4.2.23-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-07-17 08:44:58 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Description Aleksandar Kostadinov 2019-07-08 12:51:23 UTC
Description of problem:
`yum-config-manager` command is unable to enable/disable repositories from subscription. `yum config-manager` on the other hand can do this.

I think that `yum-config-manager` should be one of:
* fixed
* removed options that do not work
* at least fail to perform operations that it cannot do instead of showing success without actually doing something.

Version-Release number of selected component (if applicable):

> $ sudo yum-config-manager --version
> 4.0.9
>   Installed: dnf-0:4.0.9.2-5.el8.noarch at Tue Jun 18 17:06:18 2019
>   Built    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Thu Feb 14 > 12:04:07 2019
> 
>   Installed: rpm-0:4.14.2-9.el8.x86_64 at Tue Jun 18 17:05:16 2019
>   Built    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Thu Dec 20 > 13:30:03 2018

How reproducible:
always

Steps to Reproduce:
1. $ sudo yum-config-manager --disablerepo ansible-2.8-for-rhel-8-x86_64-rpms
 or 
2. $ sudo yum-config-manager --enablerepo ansible-2.8-for-rhel-8-x86_64-rpms

Actual results:

> Updating Subscription Management repositories.

But still /etc/yum.repos.d/redhat.repo is not updated.

Expected results:

either command should fail or it must perform the operation requested

Comment 1 Jaroslav Rohel 2019-07-17 08:44:58 UTC
This is not a bug.
Please look into the man page. "man yum-config-manager"

"--set-enabled" and "--set-disabled" must be used instead of "--enablerepo" and "--disablerepo".

Example from man page:
dnf config-manager --set-enabled <repoid>
it can be executed by this too:
yum-config-manager --set-enabled <repoid>

Comment 2 Aleksandar Kostadinov 2019-07-17 14:45:43 UTC
Running a command with unsupported flag and command doesn't fail can't be anything but a bug. If flag is not supported, then command should return a non-zero exit status and some human readable error message that flag is unknown or has been replaced or whatever.

A flag missing from documentation, especially such that has worked in previous releases doesn't mean anything and no user should be expected to re-read the man page and take note what has been removed from man pages. It is very common that man pages are incomplete.

On the other hand, the two flags are shown in `yum-config-manager --help`. So there is no excuse that it is documented.

But even if `--help` did not show the flags, then it would still be an obvious bug in my book. Is it not? Won't it cost much less time for everybody to get a couple of lines of code from the tool removed instead of losing time with arguments?

Comment 3 Karel Srot 2019-07-17 20:12:14 UTC
Hi Aleksandar,
--enablerepo cannot simply fail with an error as it is valid dnf option. Unlike in RHEL-7, in RHEL-8 config-manager is implemented as a yum/dnf plugin which means that many options are shared/reserved with/by yum itself. You are probably aware of 'yum --enablerepo=myrepo install foo'. Well, this is exactly the --enablerepo you are trying to use. This conflict is unfortunate, however I am afraid there is no perfect solution. What would you consider to be a appropriate _fix_ here?
One idea that comes to my mind is to print a warning mentioning the difference when yum-config-manager (the wrapper, not yum config-manager) itself is called with --enablerepo/--disablerepo options.

Comment 4 Aleksandar Kostadinov 2019-07-19 06:05:16 UTC
Hmm, thank you for the explanation. I couldn't realize how `--enablerepo` can be a valid option and couldn't see how bug can be closed. Excuse me for strong words.

In this situation issue seems to be that `yum-config-manager` and `dnf config-manager` commands exit with zero status without any actionable instruction given to them.

I think that if no actionable instruction has been given, then command should write something to the user and exit non-zero.

> $ sudo yum-config-manager 
> Updating Subscription Management repositories.
> $ echo $?
> 0
> $ sudo dnf config-manager
> Updating Subscription Management repositories.
> $ echo $?
> 0

e.g. with `install`

> $ sudo dnf install
> ...
> dnf install: error: the following arguments are required: PACKAGE
> $ echo $?
> 2

Do you think that can be changed?

Comment 5 Jaroslav Rohel 2019-07-19 06:43:37 UTC
Hi Aleksandar,

> A flag missing from documentation, especially such that has worked in previous releases
Are you sure that the flag is working in previous release?

I looked to documentation of old "man yum-config-manager" (used in RHEL7, Centos 7, and old Fedoras). There were documented only "--enable" and "--disable".
--enable
              Enable the specified repos (automatically saves). To enable all repositories run "yum-config-manager --enable \*".

--disable
              Disable the specified repos (automatically saves). To disable all repositories  run  "yum-config-manager  --disable
              \*".

I looked to documentation of new (DNF based plugin) "man yum-config-manager" (used in RHEL8, new Fedoras).
       --set-disabled, --disable
              Disable the specified repos (automatically saves).

       --set-enabled, --enable
              Enable the specified repos (automatically saves).

So DNF implementation accepts new options "--set-disabled, --set-enabled" and also supports old "--enable" and "--disable".

But none of implementations (that I tested) supports "--enablerepo" and "--disablerepo". And both implementation of "config-manager" do nothing with these options (and no error is generated).
So new DNF based implementation is compatible with old one.

> On the other hand, the two flags are shown in `yum-config-manager --help`. So there is no excuse that it is documented.
Yes you are right. That is not nice.
We can look on the problem but I am not sure about its solving now. The solution will not be simple. As Karel wrote. The "config manager" is a DNF plugin now. So, it starts DNF and DNF accepts all global DNF arguments. A lot of them have no meaning for the config-manager plugin. Eg. "--enablerepos" is accepted by DNF but is not used for "config-manager". We can try change behavior of the "config-manager" plugin and add support for "--enablerepo" and "--disablerepo". Or we can add warning if these options were used. But a lot of other DNF arguments are useless and they can't be easily removed from plugin.

Comment 6 Karel Srot 2019-07-19 09:04:53 UTC
(In reply to Aleksandar Kostadinov from comment #4)
> In this situation issue seems to be that `yum-config-manager` and `dnf
> config-manager` commands exit with zero status without any actionable
> instruction given to them.

We did file another bug 1706384 that would actually make that command line valid.

Comment 7 Aleksandar Kostadinov 2019-07-25 16:26:26 UTC
I tried to reply earlier but had some network issues and I now noticed my reply is not here.

I'm not sure how I came up with `--enablerepo`. I tried to migrate a rhel7 dockerfile to rhel8. And because I had subscription issues perhaps I thought my command line option is incorrect and looked at `yum-config-manager --enablerepo`. 

If `dump` is made the default probably it will be easier to spot something is not working as expected. But very important in my opinion is to fix `--help`. 

> 🐚 yum-config-manager --help
> usage: yum-config-manager config-manager [-c [config file]] [-q] [-v]
> ...
>   --assumeno            automatically answer no for all questions
>   --enablerepo [repo]
>   -x [package], --exclude [package], --excludepkgs [package]
> ...

As you can see there is no help text for the `--enablerepo` option. I think adding such info will help a lot. After adding help text I guess there's nothing much that can be done more.

Thank you again!


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