Bug 372771

Summary: After upgrade to RHEL 5.1, rhn_register against Satellite fails
Product: Red Hat Enterprise Linux 5 Reporter: Jan Pazdziora <jpazdziora>
Component: rhn-client-toolsAssignee: Pradeep Kilambi <pkilambi>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: urgent    
Version: 5.1CC: cperry, dkovalsk, jplans, riek
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0362 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 16:51:10 UTC Type: ---
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: 382571    

Description Jan Pazdziora 2007-11-09 14:27:11 UTC
Description of problem:

After upgrading my RHEL 5 GA to RHEL 5.1, rhn_register fails.

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

rhn-setup-0.4.16-1.el5

How reproducible:

Deterministic.

Steps to Reproduce:
1. Install RHEL 5 GA.
2. Register to RHN Satellite.
3. Upgrade to RHEL 5.1.
4. Try to re-register, running rhn_register.
5. Confirm Yes, Continue on the first page.
  
Actual results:

An error has occurred:
                      exceptions.TypeError
                                          See /var/log/up2date for more information

and the log file has

[Fri Nov  9 14:58:31 2007] rhn_register 
Traceback (most recent call last):
  File "/usr/sbin/rhn_register", line 79, in ?
    app.run()
  File "/usr/share/rhn/up2date_client/rhncli.py", line 65, in run
    sys.exit(self.main() or 0)
  File "/usr/sbin/rhn_register", line 64, in main
    ui.main()
  File "/usr/share/rhn/up2date_client/tui.py", line 1850, in main
    tui = Tui(screen)
  File "/usr/share/rhn/up2date_client/tui.py", line 1556, in __init__
    self.serverType = rhnreg.getServerType()
  File "/usr/share/rhn/up2date_client/rhnreg.py", line 643, in getServerType
    if host in ['xmlrpc.rhn.redhat.com', 'rhn.redhat.com'] or \
exceptions.TypeError: iterable argument required

in it.

Expected results:

No error, nice registration (re-registration).

Additional info:

Comment 1 Jan Pazdziora 2007-11-09 14:34:19 UTC
The faulty code in rhnreg.py is:

    hosted_whitelist = cfg['hostedWhitelist']

    if host in ['xmlrpc.rhn.redhat.com', 'rhn.redhat.com'] or \
       host in hosted_whitelist:
        return 'hosted'
    else:
        return 'satellite'

It assumes there is this option hostedWhitelist specified in
/etc/sysconfig/rhn/up2date. Which it is for new installations and normal
upgrades, but not if you've kickstarted your RHEL 5 GA from Satellite or changed
the up2date file -- the new one is then created as up2date.rpmnew.

Comment 2 RHEL Program Management 2007-11-09 14:34:31 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 3 RHEL Program Management 2007-11-09 14:35:32 UTC
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being proposed as a blocker for this release.  

Please resolve ASAP.

Comment 4 Jan Pazdziora 2007-11-09 14:38:16 UTC
So, we have workaround -- add 

hostedWhitelist=

to /etc/sysconfig/rhn/up2date.

Lowering Priority to high.

Comment 5 Jan Pazdziora 2007-11-09 14:39:29 UTC
And we need to apply patch similar to the following one to the code:

--- /usr/share/rhn/up2date_client/rhnreg.py.orig        2007-11-09
15:10:01.000000000 -0500
+++ /usr/share/rhn/up2date_client/rhnreg.py     2007-11-09 15:11:09.000000000 -0500
@@ -641,7 +641,7 @@
     hosted_whitelist = cfg['hostedWhitelist']
     
     if host in ['xmlrpc.rhn.redhat.com', 'rhn.redhat.com'] or \
-       host in hosted_whitelist:
+       hosted_whitelist is not None and host in hosted_whitelist:
         return 'hosted'
     else:
         return 'satellite'


Comment 7 Pradeep Kilambi 2007-11-09 16:06:30 UTC
Ok reproduced the issue on a freshly installed RHEL 5 GA client.

From my tests looks like the issue occurs only when the client is trying to
register to satellites. rhn_register and rhnreg_ks work fine against hosted. I
applied the above patch and re tried and things seems to be working well now
against sat as well as hosted..

- rhn_register works as expected against hosted and satellites (with Jan's patch)

- rhnreg_ks works as expected against hosted and satellites.

I think we can go ahead with the patch Jan proposed here.. 



Comment 9 Pradeep Kilambi 2007-11-13 19:57:58 UTC
can we get 5.1.z flag set for this as soon as possible. We need that to create
the z-stream branch for 5.1.z

Comment 11 Pradeep Kilambi 2007-12-04 19:02:40 UTC
test plan:

1. grab a freshly kickstarted RHEl-5 GA

2. rhn_register against satellite

3. Should not through any exception and register successfully

Comment 12 Jan Pazdziora 2007-12-04 19:59:09 UTC
Ummm. The test plan should continue.

4. Upgrade your RHEL 5 with all the latest erratas.

5. Try to re-rhn_register the system to that Satellite.

It's the second rhn_register which failed, for package shipped in RHEL 5.1.

Comment 16 errata-xmlrpc 2008-05-21 16:51:10 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0362.html