Bug 1418455

Summary: unable to unregister host if candlepin record is missing
Product: Red Hat Satellite Reporter: Chris Duryee <cduryee>
Component: HostsAssignee: Chris Duryee <cduryee>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: high    
Version: 6.2.7CC: abalakht, andrew.schofield, asahni, bbuckingham, bcourt, bkearney, cduryee, egolov, ehelms, hmore, h.teunis, jcallaha, mtenheuv, ninooke, nitthoma, rchauhan, ssherkar, tbhowmik, zhunting
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.0.0.115-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1426417 (view as bug list) Environment:
Last Closed: 2017-05-01 13:58:50 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: 1419985    
Bug Blocks: 1426417    
Attachments:
Description Flags
verification screenshot none

Description Chris Duryee 2017-02-01 21:28:21 UTC
Description of problem:

******
downstream-only bug! do not clone. This is already fixed upstream via a larger refactor. Its very likely not worth cherrypicking the entire change for this.
******


In certain cases, users may have hosts that are registered in Katello but not Candlepin. This typically occurs due to bugs related to registration.

When this happens, the host cannot be removed from Katello. There is some code that checks for the host's entitlements, but if it gets a 404 from Candlepin, it will error with the following:


RestClient::ResourceNotFound: Katello::Resources::Candlepin::CandlepinResource: 404 Resource Not Found {"displayMessage":"Runtime Error RESTEASY001185: Could not find resource for relative : /consumers//entitlements of full path: https://localhost:8443/candlepin/consumers//entitlements at org.jboss.resteasy.core.registry.PathParamSegment.matchPattern:209","requestUuid":"e7511d96-c594-48b2-b572-f5cb1eddd579"} (GET /candlepin/consumers//entitlements)



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


How reproducible: every time


Steps to Reproduce:
1. load database with affected records
2. attempt to delete host via foreman-rake console

Actual results: error


Expected results: successful unregister


Additional info:

Comment 4 Satellite Program 2017-02-23 21:11:35 UTC
Please add verifications steps for this bug to help QE verify

Comment 5 Chris Duryee 2017-03-01 18:03:59 UTC
repro steps:

NOTE: the repro steps involve causing some data corruption to occur!

* create fresh satellite, register one host
* log into postgres db (sudo su - postgres; psql candlepin)

* run this sql:
delete from cp_consumer_facts;
delete from cp_installed_products ;
delete from cp_consumer;

* now, attempt to delete host via web UI

without the patch, this will fail and the host will stick around. With the patch, you'll still get an error raised in the web UI, but the delete will succeed.

Comment 12 jcallaha 2017-04-10 17:44:50 UTC
Verified in Satellite 6.2.9 Snap 2.

Followed the steps outlined in #5, but was more selective with the cp_consumer delete. The host deletion task still produced an error, as expected (see attached), however the host was deleted. To get past the paused deletion task, you can go into the dynflow console, skip the "Actions::Candlepin::Consumer::Destroy" step, then navigate back to the task and click resume.

Comment 13 jcallaha 2017-04-10 17:45:47 UTC
Created attachment 1270547 [details]
verification screenshot

Comment 14 satish sherkar 2017-04-24 21:33:13 UTC
Hello Team,

Is there any workaround for this?

Comment 15 Nithin Thomas 2017-04-25 01:31:24 UTC
Hi Satish,

Please refer the below KCS:
==> https://access.redhat.com/solutions/2991221

Regards,
Nithin

Comment 18 errata-xmlrpc 2017-05-01 13:58:50 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-2017:1191