Bug 1656598

Summary: subscription-manager repos --list-enabled wrong output when repository file has enabled=false instead of enabled=0
Product: Red Hat Enterprise Linux 8 Reporter: Juan Gamba <jgamba>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: high    
Version: ---CC: awood, blc, candlepin-bugs, cdonnell, csnyder, khowell, mmuensch, redakkan, sbarcomb, skallesh
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
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: 2019-06-14 01:01:54 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:

Description Juan Gamba 2018-12-05 19:56:39 UTC
Description of problem:

When listing the enabled repositories with subscription-manager and the repository file has the new true or false (dnf) values instead of 0 or 1 (yum) the output is not correctly displayed, all such repositories are shown as enabled

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

# rpm -qa | grep subscription-manager
subscription-manager-cockpit-1.23.8-1.el8.noarch
subscription-manager-rhsm-certificates-1.23.8-1.el8.x86_64
dnf-plugin-subscription-manager-1.23.8-1.el8.x86_64
subscription-manager-1.23.8-1.el8.x86_64
subscription-manager-plugin-container-1.23.8-1.el8.x86_64
python3-subscription-manager-rhsm-1.23.8-1.el8.x86_64

How reproducible:

Always

Steps to Reproduce:
1. 
# sed -i -e 's/^enabled = 1/enabled = true/g' /etc/yum.repos.d/redhat.repo 
# sed -i -e 's/^enabled = 0/enabled = false/g' /etc/yum.repos.d/redhat.repo
2.
# subscription-manager repos --list-enabled
3.

Actual results:

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   fast-datapath-beta-for-rhel-8-x86_64-debug-rpms
Repo Name: Fast Datapath Beta for RHEL 8 x86_64 (Debug RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/layered/rhel8/x86_64/fast-datapath/debug
Enabled:   false

Repo ID:   rhel-8-for-x86_64-baseos-beta-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/baseos/os
Enabled:   false

Repo ID:   rhel-8-for-x86_64-appstream-beta-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/appstream/os
Enabled:   true

Repo ID:   rhel-8-for-x86_64-nfv-beta-source-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - Real Time for NFV Beta (Source RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/nfv/source/SRPMS
Enabled:   false

Repo ID:   codeready-builder-beta-for-rhel-8-x86_64-rpms
Repo Name: Red Hat CodeReady Linux Builder Beta for RHEL 8 x86_64 (RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/codeready-builder/os
Enabled:   false


Expected results:

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-baseos-beta-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/baseos/os
Enabled:   true

Repo ID:   rhel-8-for-x86_64-appstream-beta-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/appstream/os
Enabled:   true


Additional info:

Comment 5 Chris Snyder 2019-01-09 14:52:49 UTC
*** Bug 1633280 has been marked as a duplicate of this bug. ***

Comment 7 Rehana 2019-01-16 09:06:03 UTC
Verifying on : 
============

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.3.12-1
subscription management rules: 5.30
subscription-manager: 1.23.8-14.el8

Before modifying the values to enabled= true / disabled=false 

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-appstream-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/appstream/os
Enabled:   1

Repo ID:   rhel-8-for-x86_64-baseos-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/baseos/os
Enabled:   1

Replace enabled to true and disabled to false

# sed -i -e 's/^enabled = 1/enabled = true/g' /etc/yum.repos.d/redhat.repo 

# sed -i -e 's/^enabled = 0/enabled = false/g' /etc/yum.repos.d/redhat.repo

List-enabled 
# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-baseos-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/baseos/os
Enabled:   true

Repo ID:   rhel-8-for-x86_64-appstream-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/appstream/os
Enabled:   true

NOTICE ^ the output now contains only the repos that are set to "true"

]# subscription-manager repos --list-disabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-highavailability-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - High Availability HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/highavailability/os
Enabled:   false

Repo ID:   rhel-8-for-x86_64-rt-htb-debug-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - Real Time HTB (Debug RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/rt/debug
Enabled:   false

Repo ID:   codeready-builder-htb-for-rhel-8-x86_64-source-rpms
Repo Name: Red Hat CodeReady Linux Builder HTB for RHEL 8 x86_64 (Source RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/codeready-builder/source/SRPMS
Enabled:   false

Repo ID:   codeready-builder-htb-for-rhel-8-x86_64-debug-rpms
Repo Name: Red Hat CodeReady Linux Builder HTB for RHEL 8 x86_64 (Debug RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/codeready-builder/debug
Enabled:   false

Repo ID:   rhel-8-for-x86_64-resilientstorage-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - Resilient Storage HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/resilientstorage/os
Enabled:   false

Repo ID:   rhel-8-for-x86_64-baseos-htb-debug-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (Debug RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/baseos/debug
Enabled:   false

Repo ID:   rhel-8-for-x86_64-resilientstorage-htb-source-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - Resilient Storage HTB (Source RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/resilientstorage/source/SRPMS
Enabled:   false

NOTICE ^ the list-disabled output now contains only the repos that are set to "false"

Now lets enable a repo and make sure it appear in the list-enabled list 

# subscription-manager repos --enable=rhel-8-for-x86_64-baseos-htb-source-rpms
Repository 'rhel-8-for-x86_64-baseos-htb-source-rpms' is enabled for this system.

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-x86_64-appstream-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/appstream/os
Enabled:   true

Repo ID:   rhel-8-for-x86_64-baseos-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/baseos/os
Enabled:   true

Repo ID:   rhel-8-for-x86_64-baseos-htb-source-rpms  ==> Notice the new enabled repo is listed 
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (Source RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/baseos/source/SRPMS
Enabled:   1

similarly disable a repo 

# subscription-manager repos --disable=rhel-8-for-x86_64-baseos-htb-rpms
Repository 'rhel-8-for-x86_64-baseos-htb-rpms' is disabled for this system.

# subscription-manager  repos --list-disabled | grep "rhel-8-for-x86_64-baseos-htb-rpms" -A4
Repo ID:   rhel-8-for-x86_64-baseos-htb-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)
Repo URL:  https://cdn.redhat.com/content/htb/rhel8/8/x86_64/baseos/os
Enabled:   0


Based on the above observations , Moving the bug to Verified

Comment 9 Rehana 2020-02-04 09:32:40 UTC
*** Bug 1697053 has been marked as a duplicate of this bug. ***