+++ 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
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.
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.
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.
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 firstname.lastname@example.org 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 :
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
Author: Milan Zazrivec <email@example.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.
fixing checkstyle issues ...
Spacewalk 1.6 has been released.