Bug 1351009 - Error when disable all repos by 'subscription-manager repos --disable=*'
Summary: Error when disable all repos by 'subscription-manager repos --disable=*'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.8
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: rc
: ---
Assignee: William Poteat
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-29 03:11 UTC by qianzhan
Modified: 2020-01-30 07:30 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-21 10:55:27 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1458 None closed 1351009: Modify message to cover more scenarios 2020-05-27 11:39:49 UTC
Red Hat Product Errata RHSA-2017:0698 normal SHIPPED_LIVE Moderate: subscription-manager security, bug fix, and enhancement update 2017-03-21 12:39:12 UTC

Description qianzhan 2016-06-29 03:11:19 UTC
Description of problem:
Error when disable all repos by 'subscription-manager repos --disable=*'

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

subscription-manager: 1.16.8-8.el6
python-rhsm: 1.16.6-1.el6


How reproducible:
always

Steps to Reproduce:
1. Register rhel6.8 to satellite6.2, and auto-attach.

[root@hp-z220-13 yum.repos.d]# subscription-manager register --auto-attach
Registering to: intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: a6f19624-7220-4570-95d1-d03c16fc117c 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed


2. Try to disable all repos:
[root@hp-z220-13 yum.repos.d]# subscription-manager repos --disable=*
Error: * is not a valid repository ID. Use --list option to see valid repositories.
[root@hp-z220-13 yum.repos.d]# echo $?
1

3. Check help of 'subscription-manager repos', the "*" is supported.

[root@hp-z220-13 yum.repos.d]# subscription-manager repos --help
Usage: subscription-manager repos [OPTIONS]

List the repositories which this system is entitled to use

Options:
  -h, --help            show this help message and exit
  --proxy=PROXY_URL     proxy URL in the form of proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword=PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --list                list all known repositories for this system
  --list-enabled        list known, enabled repositories for this system
  --list-disabled       list known, disabled repositories for this system
  --enable=REPOID       repository to enable (can be specified more than
                        once). Wildcards (* and ?) are supported.
  --disable=REPOID      repository to disable (can be specified more than
                        once). Wildcards (* and ?) are supported. < ===

Actual results:
As step 2, '*' is not supported.

Expected results:
As step 3, * is supported. So step 2 should be succeessful.

Additional info:

Comment 2 vritant 2016-06-30 19:53:03 UTC
John,
please confirm the issue - John

Comment 3 John Sefler 2016-06-30 23:42:31 UTC
This is working for me against the production entitlement server using the same subscription-manager package...

[root@jsefler-rhel6 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.11-1
subscription management rules: 5.15
subscription-manager: 1.16.8-8.el6
python-rhsm: 1.16.6-1.el6

[root@jsefler-rhel6 ~]# subscription-manager register --auto-attach 
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: qa@redhat.com
Password: 
The system has been registered with ID: 0e6059e8-ec21-4bc3-a50c-c6214a6f37b6 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@jsefler-rhel6 ~]# subscription-manager repos --disable=*
Repository 'rhel-lb-for-rhel-6-server-eus-rpms' is disabled for this system.
Repository 'rhel-6-server-rhs-client-1-source-rpms' is disabled for this system.
Repository 'rhs-big-data-3-for-rhel-6-server-source-rpms' is disabled for this system.
Repository 'rhel-6-server-mrg-messaging-3-source-rpms' is disabled for this system.
Repository 'a-mq-interconnect-1-for-rhel-6-server-beta-rpms' is disabled for this system.
<... cutting out a lot of repos ...> 
Repository 'rhel-server-ose-jbosseap-6-beta-debug-rpms' is disabled for this system.
Repository 'rhel-6-server-hts-beta-rpms' is disabled for this system.
Repository 'rhel-server-ost-6-folsom-source-rpms' is disabled for this system.
Repository 'rhel-6-server-rhv-4-agent-beta-debug-rpms' is disabled for this system.
[root@jsefler-rhel6 ~]# echo $?
0


Is it possible that satellite6.2 is the problem?

Comment 4 Justin Sherrill 2016-07-28 14:46:23 UTC
I'm not able to reproduce this error with a normally registered system:

[root@client ~]# subscription-manager repos --disable=*
Repository 'rhel-server-rhscl-6-rpms' is disabled for this system.
Repository 'rhel-6-server-rpms' is disabled for this system.


However, if the system does not have any repositories available for it, you do seem to get that error:

[root@client ~]# subscription-manager  remove  --all
1 subscription removed at the server.
1 local certificate has been deleted.

[root@client ~]# subscription-manager repos --disable=*
Error: * is not a valid repository ID. Use --list option to see valid repositories.



subscription-manager-1.16.8-8.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64
yum-3.2.29-74.el6.noarch


I'm guessing this is expected behavior, but i could see an argument for --disable=* to not error if there are no repositories available.

Comment 5 John Sefler 2016-07-28 17:31:10 UTC
Thank you jsherrill for identifying the reproducer.

This is indeed a specialty use case - attempt to disable all repos using wildcard * when there are no entitled repos to disable.

If you attempt this use case and follow the instructional response from subscription manager, "Use --list option to see valid repositories.", you quickly determine the issue as shown below: "This system has no repositories available through subscriptions."

[root@jsefler-rhel7 ~]# subscription-manager repos --disable=*
Error: * is not a valid repository ID. Use --list option to see valid repositories.
[root@jsefler-rhel7 ~]# subscription-manager repos --list
This system has no repositories available through subscriptions.


My suggestion would be for the last instruction to be more explicit to avoid interpretation "subscription-manager --list" which is a completely different command.
change this:
   "Use --list option to see valid repositories."
to this:
   "Use \"subscription-manager repos --list\" to see valid repositories."

Comment 6 William Poteat 2016-07-28 20:05:54 UTC
At the point this is delivered, it does not know if there are no repos, or if they just aren't any matches.

I have put in

Error: '*' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.


Error: 'content-label-no-g' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.


So it can be accurate either way.

Comment 7 William Poteat 2016-07-29 11:53:47 UTC
pr at https://github.com/candlepin/subscription-manager/pull/1458

Comment 10 qianzhan 2016-10-18 09:16:16 UTC
Verifying on RHEL-7.3-RC-2.0 against Satellite-6.2.0-RHEL-7-20160907.6:
subscription-manager: 1.17.15-1.el7
python-rhsm: 1.17.9-1.el7


[root@dhcp-129-115 ~]# subscription-manager register
Registering to: sun-x4200-01.rhts.eng.bos.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: bf4b88b1-5235-42bb-954d-a2bb73c1d989 
[root@dhcp-129-115 ~]# subscription-manager attach


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@dhcp-129-115 ~]# subscription-manager repos --disable=*
Error: '*' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.
[root@dhcp-129-115 ~]# subscription-manager repos --disable=qqq
Error: 'qqq' does not match a valid repository ID. Use "subscription-manager repos --list" to see valid repositories.

Moving ON_QA to VERIFIED.

Comment 12 errata-xmlrpc 2017-03-21 10:55:27 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, 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://rhn.redhat.com/errata/RHSA-2017-0698.html


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