Bug 1327210

Summary: unable to register capsule via subscription-manager if previously registered via puppet
Product: Red Hat Satellite Reporter: Chris Duryee <cduryee>
Component: HostsAssignee: Chris Duryee <cduryee>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, cduryee, cwelton, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14537
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.20-1,rubygem-katello-3.0.0.21-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:00:17 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:

Description Chris Duryee 2016-04-14 13:05:03 UTC
NOTE: this was found via upstream automation, not in sat6 snapshot. It ties into the "frozen hash upon re-registration" bug (https://bugzilla.redhat.com/show_bug.cgi?id=1321710).

Description of problem: If you register a host with puppet and then attempt to register it with subscription-manager, it may "lose" its organization which causes stack traces during sub-man registration. This appears to only happen when registering a capsule.

Comment 3 Bryan Kearney 2016-04-14 14:13:06 UTC
Upstream bug component is Hosts

Comment 4 Bryan Kearney 2016-04-14 14:13:08 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14537 has been closed
-------------
Chris Duryee
Applied in changeset commit:katello|8db03a71b353ec7633270a4131c865d606d00609.
-------------
Chris Duryee
After discussion with Justin and Stephen, the most correct way to fix this is to update https://github.com/Katello/katello/blob/master/app/lib/actions/katello/host/register.rb#L9-L12 to call host.save immediately before unregistering, so the org doesn't get lost. The other PR can be undone as part of the fix, since host.organization can be relied upon again.
-------------
Chris Duryee
Applied in changeset commit:katello|9365bba8702885ddde9029b02dff6bc177d1f656.

Comment 5 Sachin Ghai 2016-04-22 09:42:28 UTC
Verified with sat6.2 beta snap9.

I can register same capsule via subscription-manager which was earlier registered via puppet.

registered the newly installed node first via puppet:


~]# vi /etc/puppet/puppet.conf
[root@mgmt7 ~]# puppet agent -t
Info: Creating a new SSL key for mgmt7.rhq.lab.eng.bos.redhat.com
Info: Caching certificate for ca
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for mgmt7.rhq.lab.eng.bos.redhat.com
Info: Certificate Request fingerprint (SHA256): 04:0C:63:4B:FE:D9:6E:D7:FA:91:05:79:98:11:C5:E5:BD:72:E7:F0:B8:16:7B:89:DE:6B:74:A5:D9:3B:BB:79
Info: Caching certificate for ca
Exiting; no certificate found and waitforcert is disabled
[root@mgmt7 ~]# puppet agent -t
Info: Caching certificate for mgmt7.rhq.lab.eng.bos.redhat.com
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for mgmt7.rhq.lab.eng.bos.redhat.com
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 400 on SERVER: Failed to find mgmt7.rhq.lab.eng.bos.redhat.com via exec: Execution of '/etc/puppet/node.rb mgmt7.rhq.lab.eng.bos.redhat.com' returned 1: 
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for mgmt7.rhq.lab.eng.bos.redhat.com
Info: Applying configuration version '1461313649'
Info: Creating state file /var/lib/puppet/state/state.yaml
Notice: Finished catalog run in 0.04 seconds



Later, registered the same node with subscription-manager
[root@mgmt7 ~]# export MASTER_FQDN=cloud-qe-17.idmqe.lab.eng.bos.redhat.com
[root@mgmt7 ~]# rpm -Uvh http://$MASTER_FQDN/pub/katello-ca-consumer-latest.noarch.rpm
Retrieving http://cloud-qe-17.idmqe.lab.eng.bos.redhat.com/pub/katello-ca-consumer-latest.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-cloud-qe-17.i################################# [100%]
[root@mgmt7 ~]# subscription-manager register --org Default_Organization --activationkey 'ak_rhel7'
The system has been registered with ID: e00cc9b2-441f-4ee5-af89-fe02c386db20 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.



Please advice if anything else needs to be tested here ?

Comment 6 Chris Duryee 2016-04-22 12:32:54 UTC
Sachin,

Those steps look good:) basically, a "no-break" test works for this BZ.

Thanks!

Comment 7 Sachin Ghai 2016-04-22 12:41:49 UTC
cool.. Thanks Chris. Moving this bz to verified as per comment5.

Comment 8 Bryan Kearney 2016-07-27 11:00:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501