Bug 889573

Summary: do not persist --serverurl option values to rhsm.conf when calling subscription-manager modules: orgs, environment, service-level
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.10CC: fsharath, jgalipea
Target Milestone: beta   
Target Release: 5.10   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 1.8.2 Doc Type: Bug Fix
Doc Text:
No description necessary
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-30 22:53:56 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: 840995, 920191    

Description John Sefler 2012-12-21 18:59:39 UTC
Description of problem:
Currently, the "--serverurl" option is used in the following use cases:

1. rhn-migrate-classic-to-rhsm --serverurl
2. subscription-manager register --serverurl
3. subscription-manager orgs --serverurl
4. subscription-manager environments --serverurl
5. subscription-manager service-level --serverurl

In each case above, the value for serverurl is currently persisted to the rhsm.conf file.  In my opinion, this is the wrong behavior for cases 3,4,5 which are query based operations.

I believe these use cases should NOT persist the serverurl values to rhsm.conf.
3. subscription-manager orgs --serverurl
4. subscription-manager environments --serverurl
5. subscription-manager service-level --serverurl


Version-Release number of selected component (if applicable):
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.1.18-1.el6.x86_64

Comment 1 Alex Wood 2013-01-03 20:13:58 UTC
commit 017043f43225d5abc381a9164352e5b35e95102b
Author: Alex Wood <awood>
Date:   Wed Jan 2 15:03:15 2013 -0500

    889573: Only persist serverurl and baseurl when registering.

Comment 2 Bryan Kearney 2013-02-08 17:18:10 UTC
Fixed in the 1.8.2 version of subscription-manager or python-rhsm

Comment 3 Sharath Dwaral 2013-02-27 22:19:42 UTC
# rpm -qa | egrep "subscription-manager|python-rhsm"
python-rhsm-1.8.3-1.el7.x86_64
subscription-manager-gui-1.8.3-1.el7.x86_64
subscription-manager-migration-1.8.3-1.el7.x86_64
subscription-manager-debuginfo-1.8.3-1.el7.x86_64
subscription-manager-1.8.3-1.el7.x86_64
subscription-manager-firstboot-1.8.3-1.el7.x86_64
python-rhsm-debuginfo-1.8.3-1.el7.x86_64

Tested of each case individually

1. rhn-migrate-classic-to-rhsm --serverurl

cat /etc/rhsm/rhsm.conf  | grep hostname
# Server hostname:
hostname = subscription.rhn.redhat.com
proxy_hostname =

# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

# rhnreg_ks --serverUrl=https://xmlrpc.rhn.code.stage.redhat.com/XMLRPC --username=qa --password=redhatqa  --force --norhnsd --nohardware --nopackages --novirtinfo
This system is not subscribed to any channels.
RHN channel support will be disabled.

# rhn-migrate-classic-to-rhsm --serverurl=fsharath-candlepin.usersys.redhat.com:8443/candlepin
Red Hat account: qa
Password: 
System Engine Username: testuser1
Password: 
Org: snowwhite

Retrieving existing RHN Classic subscription information...
Problem encountered getting the list of subscribed channels.  Exiting.

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname = subscription.rhn.redhat.com
proxy_hostname =

2. subscription-manager register --serverurl

# cat /etc/rhsm/rhsm.conf  | grep hostname
# Server hostname:
hostname = subscription.rhn.redhat.com
proxy_hostname =

# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

# subscription-manager register --serverurl fsharath-candlepin.usersys.redhat.com:8443/candlepin
Username: testuser1
Password: 
Organization: snowwhite
The system has been registered with id: e2ad42fb-4f2b-45fd-8f2f-b6d0df46387a 

# cat /etc/rhsm/rhsm.conf  | grep hostname
# Server hostname:
hostname=fsharath-candlepin.usersys.redhat.com
proxy_hostname =

3. subscription-manager orgs --serverurl

# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname=fsharath-candlepin.usersys.redhat.com
proxy_hostname =

# subscription-manager orgs --serverurl fsharath-candlepin.usersys.redhat.com:8443/candlepin
Username: testuser1
Password: 
+-------------------------------------------+
          testuser1 Organizations
+-------------------------------------------+

Name: Admin Owner
Key:  admin

Name: Snow White
Key:  snowwhite

4. subscription-manager environments --serverurl

Using the --insecure option to test this as it was tested against a server who's certs I didn't have

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname=subscription.rhn.redhat.com
proxy_hostname =

# subscription-manager environments --serverurl https://jsefler-r63-headpin.usersys.redhat.com --insecure
Username: admin
Password: 
Organization: testOrgName
+-------------------------------------------+
          Environments
+-------------------------------------------+
Name:        testEnvName
Description: testing 1 2 3

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname=subscription.rhn.redhat.com
proxy_hostname =

5. subscription-manager service-level --serverurl

# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname=subscription.rhn.redhat.com
proxy_hostname =

# subscription-manager register --serverurl fsharath-candlepin.usersys.redhat.com:8443/candlepin
Username: testuser1
Password: 
Organization: snowwhite
The system has been registered with id: 8054aad5-8370-4ab5-a23a-a053332ea1b5

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname=fsharath-candlepin.usersys.redhat.com
proxy_hostname =

change hostname in rhsm.conf file

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname = subscription.rhn.redhat.com
proxy_hostname =

# subscription-manager service-level --serverurl fsharath-candlepin.usersys.redhat.com:8443/candlepin
Service level preference not set

# subscription-manager service-level --serverurl fsharath-candlepin.usersys.redhat.com:8443/candlepin  --list
+-------------------------------------------+
               Available Service Levels
+-------------------------------------------+
None
Premium
Standard

# cat /etc/rhsm/rhsm.conf | grep hostname
# Server hostname:
hostname = subscription.rhn.redhat.com
proxy_hostname =

VERIFIED

Comment 4 RHEL Program Management 2013-04-09 20:00:29 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 6 errata-xmlrpc 2013-09-30 22:53:56 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-1332.html