Bug 1187442

Summary: subscription-manager some "--config" option can use all kinds of characters when it should be a "number"
Product: Red Hat Enterprise Linux 7 Reporter: xingge <gxing>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED NOTABUG QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: alikins, ldai, liliu, qianzhan, wpoteat
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-29 17:03:11 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:
Bug Depends On:    
Bug Blocks: 1121117    

Description xingge 2015-01-30 03:32:55 UTC
Description of problem:
subscription-manager some "--config" option can use all kinds of characters when it should be a "number"

Version-Release number of selected component (if applicable):
subscription-manager-firstboot-1.13.19-1.el7.x86_64
subscription-manager-1.13.19-1.el7.x86_64
subscription-manager-gui-1.13.19-1.el7.x86_64
python-rhsm-1.13.10-1.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1.run subscription-manager config --server.port=PORT
2.run subscription-manager config --rhsmcertd.autoattachinterval=PORT 

Actual results:
No errors report and when run "subscription-manager --config" I get output below
[server]
   hostname = subscription.rhn.stage.redhat.com
   insecure = [0]
   port = PORT      <==================should ONLY be a number
   prefix = [/subscription]
   proxy_hostname = []
   proxy_password = []
   proxy_port = []
   proxy_user = []
   ssl_verify_depth = [3]

[rhsm]
   baseurl = [https://cdn.redhat.com]
   ca_cert_dir = [/etc/rhsm/ca/]
   consumercertdir = [/etc/pki/consumer]
   entitlementcertdir = [/etc/pki/entitlement]
   full_refresh_on_yum = [0]
   manage_repos = [1]
   pluginconfdir = [/etc/rhsm/pluginconf.d]
   plugindir = [/usr/share/rhsm-plugins]
   productcertdir = [/etc/pki/product]
   repo_ca_cert = [/etc/rhsm/ca/redhat-uep.pem]
   report_package_profile = [1]

[rhsmcertd]
   autoattachinterval = PORT  <===========should ONLY be a number
   certcheckinterval = [240]

[] - Default value in use


Expected results:
when run 
subscription-manager config --server.port=PORT
there should be a error report like
"port must be 0-65535."
when run 
subscription-manager config --rhsmcertd.autoattachinterval=PORT
the error report should be
"Must enter a number"

Additional info:
I find that if you set some option that require "numbers" to a character the subscription-manager will use the default value of the option, that's good but I think we should not let the customer set a wrong option value.

Comment 1 Adrian Likins 2015-04-29 17:03:11 UTC
I devel nack'ed this.

The config values are mostly untyped, with server port being the exception.

I don't think the complexity is worthwhile to solve this generally. We
could probably special case the port values at some point, but unlikely
for 7.2.