Bug 1730146

Summary: subscription-manager fails: HTTP error (422 - Unknown): Please unregister or remove hosts which match this host before registering: <hostname>
Product: Red Hat Satellite Reporter: Jonathon Turel <jturel>
Component: RegistrationAssignee: Jonathon Turel <jturel>
Status: CLOSED ERRATA QA Contact: Stephen Wadeley <swadeley>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: akarimi, dchaudha, dvoss, egolov, garretr, gpadholi, jhutar, ktordeur, mkalyat, mmccune, pdudley, pdwyer, peter.vreman, saydas, shisingh, spetrosi, vdeshpan
Target Milestone: 6.6.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.12.0.12-1 Doc Type: If docs needed, set a value
Doc Text:
Attempting to re-register hosts that have been previously registered may result in an error. These hosts' records may need to be deleted via the UI or hammer before being able to be re-registered.
Story Points: ---
Clone Of:
: 1732891 1757096 (view as bug list) Environment:
Last Closed: 2019-10-22 19:49:22 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:

Description Jonathon Turel 2019-07-16 01:39:38 UTC
Foreman: 1.22.0
Katello: 3.12.0

While I've been working towards migrating from Spacewalk/RHSat5, I've been rebuilding hosts left & right.  I've been making changes to the host records in TFM/Katello, triggering a host build, downloading a boot ISO, and rebuilding in place.  The redhat-register provisioning template has been able to re-register and connect the host record.

Now, I'm finding that this registration is failing.  Adding a --force option doesn't seem to make a difference:

root@<host> ~]# subscription-manager register --force --name="<FQhostname>" --org='Organization' --activationkey='dev-centos7,dev-mondorescue-el7'
HTTP error (422 - Unknown): Please unregister or remove hosts which match this host before registering: <FQhostname>
[root@<hostname> ~]# subscription-manager unregister
This system is currently not registered.
[root@<hostname> ~]# subscription-manager register --force --name="<FQhostname>" --org='Land_O_Lakes' --activationkey='dev-centos7,dev-mondorescue-el7'
HTTP error (422 - Unknown): Please unregister or remove hosts which match this host before registering: <FQhostname>

jturel suggested running "hammer host subscription unregister host <FQhostname>" on the TFM/Katello host prior to the rebuild.  This work-around now lets me successfully register the host in place.

What other data or logs can I supply?  /var/log/rhsm/* doesn't seem to supply much detail beyond the above.

Comment 1 Jonathon Turel 2019-07-16 01:39:41 UTC
Created from redmine issue https://projects.theforeman.org/issues/27251

Comment 2 Jonathon Turel 2019-07-16 01:39:43 UTC
Upstream bug assigned to None

Comment 3 Jonathon Turel 2019-07-16 01:41:29 UTC
The same error can also be seen in the logs when the host is being rebuilt. The fix will likely involve triggering an unregister before the rebuild.

Comment 5 Bryan Kearney 2019-07-16 02:03:18 UTC
Upstream bug assigned to jturel

Comment 6 Brad Buckingham 2019-07-16 17:26:04 UTC
*** Bug 1730145 has been marked as a duplicate of this bug. ***

Comment 7 Brad Buckingham 2019-07-22 21:05:58 UTC
*** Bug 1717006 has been marked as a duplicate of this bug. ***

Comment 8 Brad Buckingham 2019-07-22 21:07:05 UTC
Please refer to associated duplicates for more instances of this error and additional details.

- bug 1717006
- bug 1730883

Comment 9 Jonathon Turel 2019-07-24 16:12:33 UTC
The upstream PR has the testing steps outlined: https://github.com/Katello/katello/pull/8232

Let me know if I can clarify on anything and I can update the PR to serve as the authoritative test plan for this change.

Comment 10 Bryan Kearney 2019-07-29 14:03:15 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27251 has been resolved.

Comment 14 Jonathon Turel 2019-08-16 17:07:10 UTC
Hi Hradayesh,

I will need to understand more about the specific issue you're looking into. The reason is that the error message mentioned in the bug title is 100% absolutely valid. The problem was that it was shown in some undesired circumstances. Without knowing more about the case you are working on it's hard to say whether it's expected behavior or a bug. It's also possible that you're running into https://bugzilla.redhat.com/show_bug.cgi?id=1739367

Do you have a link to a case or other supporting information on exactly the reproduction steps in your/customer's case?

Comment 19 Stephen Wadeley 2019-08-27 11:57:40 UTC
Hello

 Assignee: Jonathon Turel put test steps here:

https://github.com/Katello/katello/pull/8232#issue-300732659

Comment 27 Bryan Kearney 2019-10-22 19:49:22 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/RHSA-2019:3172