Bug 988085

Summary: After running subscription-manager config --remove server.hostname, different default values available from GUI and CLI
Product: Red Hat Enterprise Linux 6 Reporter: Chris Negus <cnegus>
Component: subscription-managerAssignee: Carter Kozak <ckozak>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: bkearney, ckozak, fsharath, gxing, jesusr, jgalipea, jsefler
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Consequence: "hostname =" line is completely removed from the rhsm.conf Fix: fix default hostname, remove excess config list output Result: hostname line will now revert to the default value
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 21:26:51 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: 862910    

Description Chris Negus 2013-07-24 17:21:30 UTC
Description of problem: After unregistering a system (subscription-manager unregister), I wanted to return to the default registration host (subscription.rhn.redhat.com), but the old registration host was left behind in /etc/rhsm/rhsm.conf. 

After deleting the value (subscription-manager config --remove server.hostname) the "hostname =" line is completely removed from the rhsm.conf file and the default hostname becomes "localhost" (subscription-manager config --list | grep hostname). There seems no way to automatically return to subscription.rhn.redhat.com.

Behavior from the GUI is different. From the Subscription Manager window, select Register. The "I will register with" box shows localhost:443/subscription. However, I could select Default to return to subscription.rhn.redhat.com (which is the behavior that I would like to be able to get to from the command line).


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

How reproducible:
Always

Steps to Reproduce:
1. Use subscription-manager to register to a system other than subscription.rhn.redhat.com.
2. Run "subscription-manager unregister"
3. Tried to return to default host by deleting value: "subscription-manager config --remove server.hostname"
4. Saw that "hostname =" line was deleted from /etc/rhsm/rhsm.conf file.
5. Ran "subscription-manager config --list | grep hostname" and saw that "hostname" was now set to "[localhost]"
6. Opened the Subscription manager window and selected Register. The "I will register with" box shows localhost:443/subscription. 
7. Selected the Default button and the value returned to the original: subscription.rhn.redhat.com 


Actual results:
There is no way I can find to get back to the "subscription.rhn.redhat.com" default value from the command line.

Expected results:
I'd like to be able to use subscription-manager to return to the subscription.rhn.redhat.com default value. It would be nice if the original hostname value in /etc/rhsm/rhsm.conf file could return to the original:
hostname = subscription.rhn.redhat.com

Additional info:

Comment 2 Carter Kozak 2013-07-31 19:32:09 UTC
commit 4761f79238e0181333296d43beef3cd79e765fb8
Author: ckozak <ckozak>
Date:   Thu Jul 25 10:46:59 2013 -0400

    988476, 988085: fix default hostname, remove excess config list output

commit ccb343c6330e16694b0ab9450c216ba3fa42f0cb
Author: ckozak <ckozak>
Date:   Wed Jul 31 12:08:11 2013 -0400

    fix config failure

Comment 3 Sharath Dwaral 2013-08-27 15:40:28 UTC
Version:

# rpm -qa | egrep "subscription-manager|python-rhsm"
subscription-manager-firstboot-1.9.5-1.el6.x86_64
subscription-manager-migration-data-1.12.3.2-1.el6.noarch
python-rhsm-1.9.4-1.el6.x86_64
subscription-manager-gui-1.9.5-1.el6.x86_64
subscription-manager-1.9.5-1.el6.x86_64
subscription-manager-migration-1.9.5-1.el6.x86_64

Verification:

# subscription-manager register --serverurl=fsharath-candlepin.usersys.redhat.com:8443/candlepin 
Username: testuser1
Password: 
Organization: admin
The system has been registered with ID: 6a868984-2a2f-402a-97bc-05f684000d03 

# cat /etc/rhsm/rhsm.conf | egrep "hostname|prefix|port"
  # Server hostname:
  hostname = fsharath-candlepin.usersys.redhat.com   <<<<< specified hostname
  # Server prefix:
  prefix = /candlepin
  # Server port:
  port = 8443
  proxy_hostname =
  # port for http proxy server
  proxy_port =

# subscription-manager unregister 
System has been unregistered.

# subscription-manager config --list | grep -A10 server
[server]
   hostname = fsharath-candlepin.usersys.redhat.com   <<<<< specified hostname
   insecure = [0]
   port = 8443
   prefix = /candlepin
   proxy_hostname = []
   proxy_password = []
   proxy_port = []
   proxy_user = []
   ssl_verify_depth = [3]

# subscription-manager config --remove server.hostname
You have removed the value for section server and name hostname.
The default value for hostname will now be used.

# cat /etc/rhsm/rhsm.conf | egrep "hostname|prefix|port"
>> # Server hostname:     <<<<<<    hostname removed
   # Server prefix:
   prefix = /candlepin
   # Server port:
   port = 8443
   proxy_hostname =
   # port for http proxy server
   proxy_port =

# subscription-manager config --list | grep -A10 server
[server]
>> hostname = [subscription.rhn.redhat.com]   <<<<<<< default hostname
   insecure = [0]
   port = 8443
   prefix = /candlepin
   proxy_hostname = []
   proxy_password = []
   proxy_port = []
   proxy_user = []
   ssl_verify_depth = [3]



Additional Information:

GUI -> Register -> I will register with: 
This is set to default (subscription.rhn.redhat.com) without having to click on Default button.

NOTE: The "Port" and "Prefix" are not defaulted on removing server.hostname they are same as passed in --serverurl during register.

VERIFIED

Comment 5 errata-xmlrpc 2013-11-21 21:26:51 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-2013-1659.html