This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 730020 - subscription-manager config usage
subscription-manager config usage
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: William Poteat
John Sefler
:
Depends On:
Blocks: rhsm-rhel62 743047
  Show dependency treegraph
 
Reported: 2011-08-11 10:47 EDT by John Sefler
Modified: 2011-12-06 12:23 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 12:23:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description John Sefler 2011-08-11 10:47:56 EDT
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 13:18:31 EDT
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 13:54:23 EDT
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 14:04:09 EDT
(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 14:20:16 EDT
(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 17:29:17 EDT
the help text is fixed in 161be6097da810447d94414d56fcbdd8eb425a52
Comment 7 John Sefler 2011-09-09 22:57:54 EDT
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 13:50:53 EDT
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 14:09:17 EDT
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 08:31:21 EDT
Changed error logging to sys.stderr.write for ConfigComand.

Commit: 600f2813db4471955e9f1efdfe4a5a1d270f7133
Comment 12 J.C. Molet 2011-09-26 14:32:38 EDT
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 12:23:24 EST
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.