Bug 1968420

Summary: Update rhsm.conf man page with additional note duplicate entries are not honoured by subscription-manager
Product: Red Hat Enterprise Linux 8 Reporter: Craig Donnelly <cdonnell>
Component: subscription-managerAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.4CC: jhnidek, redakkan, sbhamrah
Target Milestone: betaKeywords: Triaged
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.28.19-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:37:58 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 Craig Donnelly 2021-06-07 11:28:44 UTC
Description of problem:
subscription-manager will allow a user to duplicate definitions of configuration items in rhsm.conf, but ignores all but the last definition. This is mostly expected, but it does not warn the user of discarded configuration definitions.

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

How reproducible:
100%

Steps to Reproduce:
1. Duplicate a config definition, such as a proxy or prefix/hostname, anything testable.
2. Run sub-man, see it only performing based on last defined variable.

An example is to set prefix twice:

# Server prefix:
prefix = /subscription
prefix = /rhsm

Now we attempt a refresh:

# subscription-manager refresh
Remote server error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information.

Log:

2021-06-07 07:24:05,831 [ERROR] subscription-manager:10096:MainThread @managercli.py:219 - Server error attempting a GET to /rhsm/consumers/2865f156-0dcb-4140-bc1c-60ae2d6f0234/certificates/serials returned status 404

Expected results:
Configuration Error: There are duplicate configuration definitions in /etc/rhsm/rhsm.conf for: prefix.
Please remove or comment duplicate items, then re-run your command.

OR

Notice: There are two entires in /etc/rhsm/rhsm.conf for: prefix.
Using last entry: '/rhsm'.

Additional info:

Comment 2 Rehana 2021-06-09 08:59:06 UTC
Based on the triage discussion , converting this bug in to a man page update.

Comment 3 Rehana 2021-07-01 14:43:49 UTC
Pre-verifying the man page update for rhsm.conf : 
==============================================
subscription-manager: 1.28.17-1.git.41.5224c70.el8

RHSM.CONF(5)                                                                                                                                                   

NAME
       rhsm.conf - Configuration file for the subscription-manager tooling

DESCRIPTION
       The rhsm.conf file is the configuration file for various subscription manager tooling. This includes subscription-manager, subscription-manager-gui, rhsmcertd, and
       virt-who.

       The format of this file is a simple INI-like structure, with keys and values inside sections. Duplicated keys in sections are not allowed, and only the last occurrence of each key is actually used. Duplicated section names are not allowed.

Comments:
========

The text "The format of this file is a simple INI-like structure, with keys and values inside sections. Duplicated keys in sections are not allowed, and only the last occurrence of each key is actually used. Duplicated section names are not allowed. "  ​was added in the rhsm.conf man page

Comment 7 Rehana 2021-07-16 10:35:14 UTC
Verifying on :
=============
# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.19-1
subscription management rules: 5.41
subscription-manager: 1.28.19-1.el8

# rpm -qa subscription-manager --changelog | grep 1968420
- 1968420: improve description of rhsm.conf format (ptoscano)

# man rhsm.conf | grep " The format of this file" -A1 -B3
       The rhsm.conf file is the configuration file for various subscription manager tooling. This includes subscription-manager, subscription-manager-gui, rhsmcertd,
       and virt-who.

       The format of this file is a simple INI-like structure, with keys and values inside sections. Duplicated keys in sections are not allowed, and only the last
       occurrence of each key is actually used. Duplicated section names are not allowed.

^^ above section was added as a part of the bug fix. Moving the bug to Verified!!.

Comment 9 errata-xmlrpc 2021-11-09 19:37:58 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 (subscription-manager 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-2021:4390