Bug 740306 - System Profile options for a re-provisioned systems do not work as expected
Summary: System Profile options for a re-provisioned systems do not work as expected
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 0.9
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Šimon Lukašík
Depends On:
Blocks: space16
TreeView+ depends on / blocked
Reported: 2011-09-21 15:17 UTC by Milan Zázrivec
Modified: 2011-12-22 16:50 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 700711
Last Closed: 2011-12-22 16:50:25 UTC

Attachments (Terms of Use)

Description Milan Zázrivec 2011-09-21 15:17:21 UTC
+++ This bug was initially created as a clone of Bug #700711 +++

Description of problem:
Under kickstart profile -> system details - inspite of selecting the option "Delete the existing system profile and create a new system profile."  and reprovisioning the system still the old system profile is not deleted.

Version-Release number of selected component (if applicable):
RHN Satellite v5.4

How reproducible:

Steps to Reproduce:
1. Create kickstart profile on satellite v 5.4
2. Go to "System Details" in kickstart profile and select the option - Delete the existing system profile and create a new system profile.
3. Re-provision the system.
Actual results:
Old system profile is not deleted. It uses re-activation key so system id remain same and old system profile properties are applied to system. 

Expected results:
Old system profile should get deleted and new system profile should be created with new systemid and there should not be any system properties of old system profile.

Additional info:
Under /var/lib/cobbler/snippets/spacewalk/keep_system_id and post_delete_system, the keep_system_id script saves the ID in /tmp/rhn/systemid, while the post_delete_system script tries to read it from /root/systemid.old
So under post_delete_system, it can't delete the old profile as it is unable to read system id.

--- Additional comment from pmutha@redhat.com on 2011-04-29 03:30:29 EDT ---

1] Updating the post_delete_system snippet to copy /tmp/rhn/systemid to /mnt/sysimage/root/systemid.old, then the old system profile is deleted 

2] But with this change, the newly provisioned system is not registered on satellite because the kickstart profile still has the re-activation key associated with it. As the old profile is deleted, rhnreg_ks with the re-activation key of old profile fails with error "Could not find token ...."

From the re-provisioned system we can see :

cobbler.ks has :
     rhnreg_ks --serverUrl=https://satellite.gsslab.pnq.redhat.com/XMLRPC --sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT --activationkey=re-1-166a244630172f17862341d3b827fde2,1-7de52d2218a3be1aca7defb7a9e34735

ks-rhn-post.log has :
Error Message:
    Could not find token 're-1-166a244630172f17862341d3b827fde2'
Error Class Code: 60
Error Class Info: 
     The activation token specified could not be found on the server.
     Please retry with a valid key.

So it seems that even system profile gets deleted and when rhnreg_ks is executed which has re-activation key associated with it, it fails with the Could not find token '<reactivation key>'

Based on these findings, I would propose to update the post_delete_system snippet to copy systemid file to /root and also a change in kickstart formatting to not include re-activation key if options : "Delete the existing system profile and create a new system profile." is selected in the kickstart profile

Comment 1 Milan Zázrivec 2011-09-21 15:32:42 UTC
commit 6b34c33e1cbf3242a86b26917bfe6a9b03ab6f21
Author: Milan Zazrivec <mzazrivec@redhat.com>
Date:   Wed Sep 21 17:27:43 2011 +0200

740306 - fix delete -> register reprovisioning scenario
For DELETION and NONE RegistrationType, we don't want to create new
reactivation key, but simply do a "bare metal" type of registration.

Comment 2 Tomas Lestach 2011-09-22 09:52:47 UTC
fixing checkstyle issues ...
spacewalk.git: 67acf7515cc9608b735387349bcad542e0f26180

Comment 3 Milan Zázrivec 2011-12-22 16:50:25 UTC
Spacewalk 1.6 has been released.

Note You need to log in before you can comment on or make changes to this bug.