Bug 576211

Summary: Centos kickstart fails at registration due to regex error in KickstartFormatter
Product: [Community] Spacewalk Reporter: Gavin White <white.gavin>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: low    
Version: 0.8   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 613994 (view as bug list) Environment:
Last Closed: 2010-05-10 14:47:57 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: 582354, 613994    

Description Gavin White 2010-03-23 14:14:23 UTC
Description of problem:



I have created a kickstart distribution and profile for a channel built from the Centos 5.4 x86_64 DVD. The kickstart profile is configured to register using an activation key.

There is a line in the auto generated kickstart file which goes:

perl -npe 's/xmlrpc.rhn.redhat.com/my.fqdn.server/' -i /etc/sysconfig/rhn/up2date

(where my.fqdn.server is my actual spacewalk server)

I believe this is expecting to find the following in the up2date file:

serverURL=https:// xmlrpc.rhn.redhat.com /XMLRPC

However, the up2date file from the Centos DVD contains the following:

#serverURL=https://xmlrpc.rhn.redhat.com/XMLRPC 
serverURL=https://enter.your.server.url.here/XMLRPC

This means that the hashed out entry gets fixed, and my newly kickstarted machine tries to register against enter.your.server.url.here.

It looks like this is done at http://git.fedorahosted.org/git/spacewalk.git/?p=spacewalk.git;a=blob;f=java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java;h=63e73d66431faeb308208e1ffdc7bf49b04faa93;hb=HEAD#l659

I think it would be better to do something like this:

perl -npe 's/serverURL=https:\/\/.*\/XMLRPC/serverURL=https:\/\/@@http_server@@\/XMLRPC/' -i /etc/sysconfig/rhn/up2date

rather than the current approach:

perl -npe 's/xmlrpc.rhn.redhat.com/@@http_server@@/'  -i /etc/sysconfig/rhn/up2date



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

spacewalk 8.0

How reproducible:

For me, every time. 

Steps to Reproduce:
1. create a software channel based on centos5.4 x86_64
2. create a child channel which contains rhn-client-tools etc.
3. build a kickstart distribution from the centos5.4 x86_64 DVD
2. build a kickstart profile which uses the centos channel and link it to an activation key
3. run the kickstart install
  
Actual results:
- See the rhnreg_ks failure in /root/ks-post.log
- After rebooting the new server, see the entry 'serverURL=https://enter.your.server.url.here/XMLRPC' in /etc/sysconfig/up2date


Expected results:
New server is registered to spacewalk using an activation key

I can download the kickstart file, edit it to fix the serverURL line and kickstart off it, and I end up with a properly registered machine.


Additional info:


As a sanity test, I have just uninstalled rhn-client-tools, which provides /etc/sysconfig/rhn/up2date, and reinstalled it from http://spacewalk.redhat.com/yum/0.8/RHEL/5/x86_64/spacewalk-client-repo-0.8-1.el5.noarch.rpm. The up2date file contains:

serverURL[comment]=Remote server URL
#serverURL=https://xmlrpc.rhn.redhat.com/XMLRPC
serverURL=https://enter.your.server.url.here/XMLRPC

ie. this would not work with the serverURL regex built into spacewalk's kickstart.

Comment 1 Gavin White 2010-03-23 14:15:47 UTC
Typo: by 'the up2date file from the Centos DVD' I meant the one from spacewalk-client-repo.

Comment 2 Michael Mráka 2010-04-19 14:31:11 UTC
FIxed by modifying regular expression

commit 39e2ca81ef152e3d6c47633b0ce71138e5f45b04
    576211 - fixed server name replacement pattern

Package spacewalk-java-1.0.4-1 and spacewalk-config-1.0.1-1.

Comment 3 Michael Mráka 2010-05-10 14:47:57 UTC
This bug has been fixed in Spacewalk 1.0.