Bug 830904

Summary: Combining an activation key and a reactivation key will not install the software of the activation key
Product: Red Hat Satellite 5 Reporter: Felix Dewaleyne <fdewaley>
Component: ProvisioningAssignee: Stephen Herr <sherr>
Status: CLOSED NOTABUG QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 541CC: cperry
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-10 18:57:49 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: 924189    

Description Felix Dewaleyne 2012-06-11 15:40:25 UTC
Description of problem:
When attempting to use rhnreg_ks with both an activation key and a reactivation key, none of the software of the activation key is installed but the right channels are being subscribed.

Version-Release number of selected component (if applicable):
satellite 5.4.1 latest stable

How reproducible:
all the time

Steps to Reproduce:
1. create a RHEL6.1 channel with spacewalk-create-channel
2. clone rhn-client-tools to a child channel of that previously created channel
3.create a kickstart installing @base and only subscribing to a cloned based channel
4. create an activation key that will install rhncfg-client and rhncfg along with register to the rhn-client-tools clone created. I'll refer to it as key1
5. register a RHEL6.1 system and create a reactivation key "key2"
6. create a %post step using rhnreg_ks --activationkey key1,key2 --force
7. provision the registered machine with that kickstart
  
Actual results:
the machine is kickstarted, registered correctly to the satellite (it reuses the same profile) but the rhncfg-client and rhncfg packages aren't installed

Expected results:
the machine is registered to the right channels and the packages are instaled

Additional info:
only happens for RHEL6.

Comment 1 Stephen Herr 2013-07-10 18:57:49 UTC
This is not the correct way to use an activation key with a kickstart profile.

The reason is twofold:
1) by specifying a reactivation key in a post script you are statically tying that kickstart profile to that single server. Kickstart profiles are supposed to be generic and useful for many different servers, the cobbler system record that gets created when you re-provision a specific server is the thing that's supposed to be specific.
2) reactivation keys are only useful once, when they are reused they are deleted. If you generate a new reactivation key the old one is deleted. This would mean that each and every time you wanted to use this kickstart profile you would have to update that %post script.

Problem #2 is the reason what you're doing is not working, because the kickstart profile by default re-connects the server to it's old profile and in doing so it regenerates a reactivation key. So when you get to rhnreg_ks in the %post the second key is invalid, and the registration fails with an invalid key error without executing the first key.

The correct way to accomplish what you want is to go to the "Activation Keys" tab of the kickstart profile and set key1 as being associated with this profile. Also ensure that on the "System Details" tab of the profile it is set to "Re-connect to the existing system profile" (default). You will also have to modify the base channel on the Activation Key to be the desired cloned base channel (and then make sure the child channel selection and package installation selection is still correct afterwards), if you leave it as "Satellite default" you will wind up registered to the Satellite default, aka the regular RHEL channel. Satellite now can generate an appropriate kickstart file that will do all the right things, and it will work for any system that wants to register to this base channel / use this activation key, not just that specific one.

Closing as NOTABUG.