Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1605188 - Regression of Bug 1575113 - Host registration fails with the error: "Validation failed: Host has already been taken"
Summary: Regression of Bug 1575113 - Host registration fails with the error: "Validati...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.3.2
Hardware: All
OS: All
high
high
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: jcallaha
URL:
Whiteboard:
: 1599700 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-20 12:13 UTC by Jan Jansky
Modified: 2022-03-13 15:16 UTC (History)
13 users (show)

Fixed In Version: tfm-rubygem-katello-3.4.5.78-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-22 20:07:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 23516 0 Normal Closed Host registration fails with the error: "Validation failed: Host has already been taken" 2020-10-06 14:47:07 UTC
Red Hat Knowledge Base (Solution) 3436541 0 None None None 2018-07-20 12:56:31 UTC
Red Hat Product Errata RHBA-2018:2550 0 None None None 2018-08-22 20:07:47 UTC

Description Jan Jansky 2018-07-20 12:13:56 UTC
Description of problem:
Try to register again not correctly removed host ends with 

"Validation failed: Host has already been taken"


Version-Release number of selected component (if applicable):
Satellite 6.3.2

How reproducible:
Not sure


Steps to Reproduce:
1. Host was already removed from candlepin and pulp DB
2. Manually removed from foreman DB
3. Re-registration

Actual results:
"Validation failed: Host has already been taken

Expected results:
Successful registration.

Additional info:
Solved by applying https://access.redhat.com/solutions/3436541, with small changes according to difference between 6.3.1 and 6.3.2

Comment 1 Justin Sherrill 2018-07-20 15:04:52 UTC
Can you provide the exact steps you took for:

1. Host was already removed from candlepin and pulp DB
2. Manually removed from foreman DB

Comment 2 Jan Jansky 2018-07-20 15:22:16 UTC
1. I cannot because when customer created the case it was already missing from candlepin and pulp DB
2. su - postgres -c "psql foreman"

delete from host_status where host_id = x;
delete from katello_subscription_facet_activation_keys where subscription_facet_id = y;
delete from katello_subscription_facets where host_id = x;
delete from nics where host_id = x;
delete from hosts where id = x;

Comment 3 Justin Sherrill 2018-07-20 15:28:55 UTC
Jan, 

Your comment in the case:


After some investigation we found out that changes which should be present in your version are not, i applied those changes into your code and we tested functionality, registration seems to work, please feel free to test it more. I will discuss with developers why is this part of code not applied. 

makes me think they weren't actually fully on 6.3.2.  Can you have them upload a foreman-debug?

Comment 5 Jan Jansky 2018-07-20 15:42:05 UTC
Justin,
i checked on the server file /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.74/app/services/katello/registration_manager.rb which as far as i know is the only file relevant to this issue, it came from 

tfm-rubygem-katello-3.4.5.74-1.el7sat.noarch.rpm

which correspond to 

https://access.redhat.com/errata/RHBA-2018:1950

Comment 6 Justin Sherrill 2018-07-20 16:01:46 UTC
You guys are correct, this change is completely missing from 6.3.2 (and 6.3.3) it appears that there was some issue with the release that caused this fix to be missed.  Coupled with the fact that we could never reproduce internally, our qe wasn't able to catch it.  

I will work with our release team to correct the problem.

Comment 9 Satellite Program 2018-07-20 18:12:02 UTC
Upstream bug assigned to jsherril

Comment 10 Satellite Program 2018-07-20 18:12:05 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23516 has been resolved.

Comment 11 Justin Sherrill 2018-07-20 20:32:20 UTC
*** Bug 1599700 has been marked as a duplicate of this bug. ***

Comment 14 jcallaha 2018-08-03 18:48:38 UTC
Verified in Satellite 6.3.3 Snap 2.

I performed over 4000 host registrations, and did not encounter this issue.

Additionally, I checked the file and the expected changes are in place.

-bash-4.2# find / -name registration_manager.rb
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.78/app/services/katello/registration_manager.rb
-bash-4.2# 
-bash-4.2# catline 99 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.78/app/services/katello/registration_manager.rb
        host.subscription_facet.update_subscription_status(::Katello::SubscriptionStatus::UNKNOWN)

Comment 15 Logan Kuhn 2018-08-06 14:55:28 UTC
I'm in the process of testing Satellite 6.3 in our environment, is there a way I could test that update in our environment?  It'd make my life a lot easier getting it approved.

Logan

Comment 16 Mike McCune 2018-08-08 14:51:40 UTC
Logan, can you open a Red Hat support case and email me with the case# to mmccune @ redhat.com 

I'll get you the RPMs.

Comment 17 Logan Kuhn 2018-08-08 14:53:04 UTC
Case# 02153260

Comment 18 Logan Kuhn 2018-08-13 13:47:11 UTC
I no longer experience the issue after installing the RPMs.  Thank you

Comment 24 errata-xmlrpc 2018-08-22 20:07:12 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-2018:2550


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