Bug 1575140 - Cannot delete host when missing from the candlepin database
Summary: Cannot delete host when missing from the candlepin database
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.3.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.4.0
Assignee: Justin Sherrill
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
: 1609066 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-04 20:52 UTC by David Kaylor
Modified: 2019-11-05 23:18 UTC (History)
22 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1609066 1624019 (view as bug list)
Environment:
Last Closed: 2018-10-16 18:56:44 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 23489 0 Normal Closed unregistration doesn't handle hosts never registered in candlepin 2020-11-11 19:39:20 UTC
Red Hat Knowledge Base (Solution) 3424791 0 None None None 2018-07-11 09:09:55 UTC
Red Hat Product Errata RHBA-2018:2550 0 None None None 2018-08-22 20:07:47 UTC

Description David Kaylor 2018-05-04 20:52:54 UTC
Description of problem:
If a host cannot be found in the candlepin database, attempting to delete this host will fail with an error similar to the following:

Katello::Resources::Candlepin::Consumer: 404 Resource Not Found {"displayMessage":"Consumer with id e7d9a1f4-51f7-4b9a-b92b-43f72ce371de could not be found.","requestUuid":"22fcfb9a-6e57-46ca-8e39-184ec57035c2"} (DELETE /candlepin/consumers/e7d9a1f4-51f7-4b9a-b92b-43f72ce371de) 

Katello::Resources::Candlepin::Consumer: 404 Resource Not Found {"displayMessage":"Consumer with id d346d3f2-a287-4e55-8a93-eec225495245 could not be found.","requestUuid":"614508bb-5b43-4ac4-9768-ad82a884dfbb"} (DELETE /candlepin/consumers/d346d3f2-a287-4e55-8a93-eec225495245)

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

How reproducible:

The customer is not sure how the host got into its current state. I was able to reproduce it by manually deleting candlepin records from the database.


Steps to Reproduce:
1. Register a content host to Satellite
2. Connect to the candlepin database and run queries to delete the consumer. Example:

delete from cp_consumer_facts where cp_consumer_id = '4028fcae632b664d01632cc5dffd0000';
delete from cp_ent_certificate where entitlement_id in (select id from  cp_entitlement where consumer_id = '4028fcae632b664d01632cc5dffd0000');
delete from cp_entitlement where consumer_id = '4028fcae632b664d01632cc5dffd0000';
delete from cp_installed_products where consumer_id = '4028fcae632b664d01632cc5dffd0000';
delete from cp_consumer where id = '4028fcae632b664d01632cc5dffd0000';

3. Attempt to delete the host via the web UI or hammer

Actual results:
Host is not deleted and an error is received

Expected results:
Host is deleted

Additional info:
We also tried using the following but it did not help:

# foreman-rake katello:clean_backend_objects COMMIT=true
# foreman-rake katello:reimport

Comment 3 pm-sat@redhat.com 2018-05-14 22:07:34 UTC
Upstream bug assigned to jsherril@redhat.com

Comment 4 pm-sat@redhat.com 2018-05-14 22:07:37 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23489 has been resolved.

Comment 13 Lukáš Hellebrandt 2018-07-26 11:43:14 UTC
Verified with Sat 6.4 snap 13.

Used reproducer from OP, the host got deleted, no traceback.

Comment 17 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

Comment 18 Mike McCune 2018-08-28 20:48:43 UTC
This bug was mistakenly added to https://access.redhat.com/errata/RHBA-2018:2550 6.3.3 but was not shipped in that update.

We will be releasing this in 6.3.4 and making a hotfix available here for anyone on 6.3.3 who needs this fix.

Comment 23 Bryan Kearney 2018-10-16 18:56:44 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-2018:2927

Comment 24 Mike McCune 2018-10-18 16:49:30 UTC
*** Bug 1609066 has been marked as a duplicate of this bug. ***


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