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 730020 - subscription-manager config usage
Summary: subscription-manager config usage
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: William Poteat
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62 743047
TreeView+ depends on / blocked
 
Reported: 2011-08-11 14:47 UTC by John Sefler
Modified: 2011-12-06 17:23 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 17:23:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1695 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2011-12-06 01:23:29 UTC

Description John Sefler 2011-08-11 14:47:56 UTC
Description of problem:
Initial comments on the new subscription-manager "config" module...


Please consider changing the in-line help as follows:

[root@jsefler-onprem-62server ~]# subscription-manager config --help
Usage: subscription-manager config [OPTIONS]

List the configuration which this machine is using

^^^^^^ NEEDS TO INCLUDE THE WORD "SET".  Something like this would be good:
List or set various entitlement system configuration values

Options:
  -h, --help            show this help message and exit
  --list                list the configuration for this system
  --hostname=HOSTNAME   Host Name for entitlement system
                        ^^^ set server hostname configuration 
  --prefix=PREFIX       Prefix for entitlement system host
                        ^^^ set server prefix configuration 
  --port=PORT           Port for entitlement system host
                        ^^^ set server port configuration 
  --proxy_hostname=PROXY_HOSTNAME
                        Hostname for entitlement system proxy
                        ^^^ set server proxy hostname configuration 
  --proxy_port=PROXY_PORT
                        Port for entitlement system proxy
                        ^^^ set server proxy port configuration 
  --proxy_user=PROXY_USER
                        Username for entitlement system proxy
                        ^^^ set server proxy user configuration 
  --proxy_password=PROXY_PASSWORD
                        Password for entitlement system proxy
                        ^^^ set server proxy password configuration 

Please consider changing the in-line help for the options as shown above ^^^.



How do I UNSET a config value?  The following doesn't work...

# subscription-manager config --proxy_port=""
Error: No options provided. Please see the help comand.

This doesn't work either
# subscription-manager config --proxy_port --proxy_hostname foo
# cat /etc/rhsm/rhsm.conf | grep proxy_
proxy_hostname =200
proxy_port =--proxy_hostname
proxy_user =
proxy_password =


What does seem to work is setting a blank space " ", but that's wasn't immediately obvious.



Also, we should probably block when the user includes --list option together with a setter option.  Like this:
# subscription-manager config --list --proxy_port=222
hostname = jsefler-onprem-62candlepin.usersys.redhat.com
prefix = /candlepin
port = 8443
insecure = 0
ssl_verify_depth = 3
ca_cert_dir = /etc/rhsm/ca/
proxy_hostname = 200
proxy_port = --proxy_hostname
proxy_user = 
proxy_password = 
repo_ca_cert = /etc/rhsm/ca/redhat-uep.pem


^^^ THE SETTER WAS IGNORED.  EXPECTED SOMETHING LIKE:
Error: --list should not be used with options used for setting configurations



Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.5-1.git.19.8802aeb.el6.x86_64

Comment 1 William Poteat 2011-08-22 17:18:31 UTC
This has been redesigned:

--list shows the entries available for modification. The list is dynamically produced from the entries already in the file. It includes the default entries for each section despite the fact that they are not in the actual file. It is a true representation as to what will get used when that entry is called for in the code.

--[section].[entry name] [value]   Allows the user to change an entry.

--remove [section].[entry name]    Allows the user to remove an entry value. If there is no default for that entry, the value in the file is changed to [empty string]. if there is a default value, the value in the file is removed completely so that the default value will be expressed.

Comment 3 J.C. Molet 2011-08-22 17:54:23 UTC
Example of new behavior:

[root@jmolet-vm0 ~]# subscription-manager config --list
[server]
   hostname = mgmt5.rhq.lab.eng.bos.redhat.com
   prefix = /candlepin
   port = 8443
   insecure = 0
   ssl_verify_depth = 3
   ca_cert_dir = /etc/rhsm/ca/
   proxy_hostname = 
   proxy_port = 
   proxy_user = 
   proxy_password = 
   repo_ca_cert = /etc/rhsm/ca/redhat-uep.pem

[rhsm]
   baseurl = https://mockamai.devlab.phx1.redhat.com
   repo_ca_cert = /etc/rhsm/ca/fakamai-cp1.pem
   productcertdir = /etc/pki/product
   entitlementcertdir = /etc/pki/entitlement
   consumercertdir = /etc/pki/consumer
   proxy_hostname = 
   insecure = 0
   ssl_verify_depth = 3
   proxy_password = 
   proxy_port = 
   prefix = /candlepin
   port = 8443
   proxy_user = 
   hostname = localhost
   ca_cert_dir = /etc/rhsm/ca/

[rhsmcertd]
   certfrequency = 240
   proxy_hostname = 
   insecure = 0
   ssl_verify_depth = 3
   proxy_password = 
   proxy_port = 
   prefix = /candlepin
   repo_ca_cert = /etc/rhsm/ca/redhat-uep.pem
   port = 8443
   proxy_user = 
   hostname = localhost
   ca_cert_dir = /etc/rhsm/ca/

[root@jmolet-vm0 ~]# subscription-manager config --help
Usage: subscription-manager config [OPTIONS]

List the configuration which this machine is using

Options:
  -h, --help            show this help message and exit
  --list                list the configuration for this system
  --remove=REMOVE       remove configuration entry by section.name
  --server.hostname=SERVER.HOSTNAME
                        Section: server, Name: hostname
  --server.prefix=SERVER.PREFIX
                        Section: server, Name: prefix
  --server.port=SERVER.PORT
                        Section: server, Name: port
  --server.insecure=SERVER.INSECURE
                        Section: server, Name: insecure
  --server.ssl_verify_depth=SERVER.SSL_VERIFY_DEPTH
                        Section: server, Name: ssl_verify_depth
  --server.ca_cert_dir=SERVER.CA_CERT_DIR
                        Section: server, Name: ca_cert_dir
  --server.proxy_hostname=SERVER.PROXY_HOSTNAME
                        Section: server, Name: proxy_hostname
  --server.proxy_port=SERVER.PROXY_PORT
                        Section: server, Name: proxy_port
  --server.proxy_user=SERVER.PROXY_USER
                        Section: server, Name: proxy_user
  --server.proxy_password=SERVER.PROXY_PASSWORD
                        Section: server, Name: proxy_password
  --server.repo_ca_cert=SERVER.REPO_CA_CERT
                        Section: server, Name: repo_ca_cert
  --rhsm.baseurl=RHSM.BASEURL
                        Section: rhsm, Name: baseurl
  --rhsm.repo_ca_cert=RHSM.REPO_CA_CERT
                        Section: rhsm, Name: repo_ca_cert
  --rhsm.productcertdir=RHSM.PRODUCTCERTDIR
                        Section: rhsm, Name: productcertdir
  --rhsm.entitlementcertdir=RHSM.ENTITLEMENTCERTDIR
                        Section: rhsm, Name: entitlementcertdir
  --rhsm.consumercertdir=RHSM.CONSUMERCERTDIR
                        Section: rhsm, Name: consumercertdir
  --rhsm.proxy_hostname=RHSM.PROXY_HOSTNAME
                        Section: rhsm, Name: proxy_hostname
  --rhsm.insecure=RHSM.INSECURE
                        Section: rhsm, Name: insecure
  --rhsm.ssl_verify_depth=RHSM.SSL_VERIFY_DEPTH
                        Section: rhsm, Name: ssl_verify_depth
  --rhsm.proxy_password=RHSM.PROXY_PASSWORD
                        Section: rhsm, Name: proxy_password
  --rhsm.proxy_port=RHSM.PROXY_PORT
                        Section: rhsm, Name: proxy_port
  --rhsm.prefix=RHSM.PREFIX
                        Section: rhsm, Name: prefix
  --rhsm.port=RHSM.PORT
                        Section: rhsm, Name: port
  --rhsm.proxy_user=RHSM.PROXY_USER
                        Section: rhsm, Name: proxy_user
  --rhsm.hostname=RHSM.HOSTNAME
                        Section: rhsm, Name: hostname
  --rhsm.ca_cert_dir=RHSM.CA_CERT_DIR
                        Section: rhsm, Name: ca_cert_dir
  --rhsmcertd.certfrequency=RHSMCERTD.CERTFREQUENCY
                        Section: rhsmcertd, Name: certfrequency
  --rhsmcertd.proxy_hostname=RHSMCERTD.PROXY_HOSTNAME
                        Section: rhsmcertd, Name: proxy_hostname
  --rhsmcertd.insecure=RHSMCERTD.INSECURE
                        Section: rhsmcertd, Name: insecure
  --rhsmcertd.ssl_verify_depth=RHSMCERTD.SSL_VERIFY_DEPTH
                        Section: rhsmcertd, Name: ssl_verify_depth
  --rhsmcertd.proxy_password=RHSMCERTD.PROXY_PASSWORD
                        Section: rhsmcertd, Name: proxy_password
  --rhsmcertd.proxy_port=RHSMCERTD.PROXY_PORT
                        Section: rhsmcertd, Name: proxy_port
  --rhsmcertd.prefix=RHSMCERTD.PREFIX
                        Section: rhsmcertd, Name: prefix
  --rhsmcertd.repo_ca_cert=RHSMCERTD.REPO_CA_CERT
                        Section: rhsmcertd, Name: repo_ca_cert
  --rhsmcertd.port=RHSMCERTD.PORT
                        Section: rhsmcertd, Name: port
  --rhsmcertd.proxy_user=RHSMCERTD.PROXY_USER
                        Section: rhsmcertd, Name: proxy_user
  --rhsmcertd.hostname=RHSMCERTD.HOSTNAME
                        Section: rhsmcertd, Name: hostname
  --rhsmcertd.ca_cert_dir=RHSMCERTD.CA_CERT_DIR
                        Section: rhsmcertd, Name: ca_cert_dir


--remove and setting values work as expected as well.

setting and listing in the same command still behaves the same way as it did when this bug was opened.

Comment 4 J.C. Molet 2011-08-22 18:04:09 UTC
(In reply to comment #0)


> Also, we should probably block when the user includes --list option together
> with a setter option.  Like this:
> # subscription-manager config --list --proxy_port=222
> hostname = jsefler-onprem-62candlepin.usersys.redhat.com
> prefix = /candlepin
> port = 8443
> insecure = 0
> ssl_verify_depth = 3
> ca_cert_dir = /etc/rhsm/ca/
> proxy_hostname = 200
> proxy_port = --proxy_hostname
> proxy_user = 
> proxy_password = 
> repo_ca_cert = /etc/rhsm/ca/redhat-uep.pem
> 
> 
> ^^^ THE SETTER WAS IGNORED.  EXPECTED SOMETHING LIKE:
> Error: --list should not be used with options used for setting configurations
> 

Moving this back to ASSIGNED as this still needs to be fixed.

Comment 5 John Sefler 2011-08-22 18:20:16 UTC
(In reply to comment #0)

> Please consider changing the in-line help as follows:
> 
> [root@jsefler-onprem-62server ~]# subscription-manager config --help
> Usage: subscription-manager config [OPTIONS]
> 
> List the configuration which this machine is using
> 
> ^^^^^^ NEEDS TO INCLUDE THE WORD "SET".  Something like this would be good:
> List or set various entitlement system configuration values

Was this request overlooked or vetoed?

Comment 6 Bryan Kearney 2011-09-01 21:29:17 UTC
the help text is fixed in 161be6097da810447d94414d56fcbdd8eb425a52

Comment 7 John Sefler 2011-09-10 02:57:54 UTC
Lets try this again....

[root@jsefler-onprem-62server ~]# subscription-manager config -h | grep Usage -A2
Usage: subscription-manager config [OPTIONS]

List or set the configuration which this machine is using

^^^^
PLEASE CHANGE THE USAGE MESSAGE TO INCLUDE ALL THREE FUNCTIONS list, set, remove:
List, set or remove configuration parameters in use by this machine

AND STILL UNRESOLVED is the case when the user includes --list option together
with a setter option or a remove.  Like this:

# subscription-manager config --list --rhsm.proxy_port=22 --remove rhsm.proxy_port

Expected stderr output:
 Error: --list should not be used with any other options for setting or removing configurations
Expected exit code: 255

Moving back to NEW

Comment 9 John Sefler 2011-09-23 17:50:53 UTC
Final Verifications...
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.11-1.el6.x86_64


[root@jsefler-onprem-62server ~]# subscription-manager config -h | grep Usage -A2
Usage: subscription-manager config [OPTIONS]

List, set, or remove the configuration parameters in use by this machine.

^^^^  ^^^     ^^^^^^
ALL THREE FUNCTIONS OF THIS MODULE ARE NOW LISTED IN THE USAGE



[root@jsefler-onprem-62server ~]#  subscription-manager config --list --rhsm.proxy_port=22 --remove rhsm.proxy_port
Error: --list should not be used with any other options for setting or removing configurations.
[root@jsefler-onprem-62server ~]#  subscription-manager config --list --rhsm.proxy_port=22
Error: --list should not be used with any other options for setting or removing configurations.
[root@jsefler-onprem-62server ~]#  subscription-manager config --list --remove rhsm.proxy_port
Error: --list should not be used with any other options for setting or removing configurations.
[root@jsefler-onprem-62server ~]# 

^^^^
VERIFIED THAT LIST SHOULD NOT BE CALLED WITH SET AND/OR REMOVE OPTIONS

moving to VERIFIED




NOTE:
It's bad practice to combine calls to set and remove configs at the same time, e.g....
subscription-manager config --rhsm.proxy_port=22 --remove rhsm.proxy_port

Make two separate calls instead. e.g....
subscription-manager config --rhsm.proxy_port=22
subscription-manager config --remove rhsm.proxy_port

Comment 10 John Sefler 2011-09-23 18:09:17 UTC
Ooops... pulled the trigger too fast
moving back to ASSIGNED...

[root@jsefler-onprem-62server ~]# subscription-manager config --list --rhsm.proxy_port=22 --remove rhsm.proxy_port 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-onprem-62server ~]# echo $?
255
[root@jsefler-onprem-62server ~]# cat /tmp/stderr
[root@jsefler-onprem-62server ~]# cat /tmp/stdout
Error: --list should not be used with any other options for setting or removing configurations.
[root@jsefler-onprem-62server ~]# 

^^^ THE ERROR MESSAGE SHOULD GO TO STDERR NOT STDOUT

Comment 11 William Poteat 2011-09-26 12:31:21 UTC
Changed error logging to sys.stderr.write for ConfigComand.

Commit: 600f2813db4471955e9f1efdfe4a5a1d270f7133

Comment 12 J.C. Molet 2011-09-26 18:32:38 UTC
Issues in comment 10 look resolved:

[root@jmolet-vm0 ~]# subscription-manager config --list --rhsm.proxy_port=22 --remove rhsm.proxy_port 1>/tmp/stdout 2>/tmp/stder
[root@jmolet-vm0 ~]# echo $?
255
[root@jmolet-vm0 ~]# cat /tmp/stderr
Error: Section rhsmcertd and name unknown_prop does not exist.
[root@jmolet-vm0 ~]# cat /tmp/stdout
[root@jmolet-vm0 ~]#


Marking VERIFIED.  Tests were performed against version:

subscription-manager-0.96.11-1.git.11.4ea289b.el6.x86_64

Comment 13 errata-xmlrpc 2011-12-06 17:23:24 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.

http://rhn.redhat.com/errata/RHBA-2011-1695.html


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