Bug 692638

Summary: No User readable error displayed on console while import invalid Owner.
Product: [Community] Candlepin Reporter: spandey
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED WONTFIX QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 0.5CC: dgoodwin, jesusr, jmolet, kbanerje, spandey
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-20 18:50:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description spandey 2011-03-31 18:47:48 UTC
Description of problem:


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


How reproducible:
10/10

Prerequisites
Candlepin A ,Candlepin B (on-premises)

Steps to repro  :
import Invalid Owner from Candlepin A .
Import Owner from invalid Candlepin (not candlepin ip).

Expected Result : 
At step 1 
Proper Error message should display on console for invalid Owner.
At step 2
Proper  Error message should display invalid Candlepin URL 

Actual Result : 
Migration started no error msg displayed on console.

[root@candlepin1 ~]# curl -k -u admin:admin -X POST "https://10.65.193.123:8443/candlepin/migrations?entity=owner&id=101010101001010101010101&uri=10.65.193.174:8080"
{"id":"migrate_owner_9cbfb240-a8f8-4de6-bbf6-427b727706ad","state":"CREATED","result":null,"startTime":null,"finishTime":null,"statusPath":"/jobs/migrate_owner_9cbfb240-a8f8-4de6-bbf6-427b727706ad","updated":"2011-03-31T18:30:21.031+0000","created":"2011-03-31T18:30:21.031+0000"}[root@candlepin1 ~]# 

[root@candlepin1 ~]# curl -k -u admin:admin -X POST "https://10.65.193.123:8443/candlepin/migrations?entity=owner&id=101010101001010101010101&uri=10.65.193.74:8080"
{"id":"migrate_owner_581914a7-909d-4ef1-96fa-2e780eb4fcaf","state":"CREATED","result":null,"startTime":null,"finishTime":null,"statusPath":"/jobs/migrate_owner_581914a7-909d-4ef1-96fa-2e780eb4fcaf","updated":"2011-03-31T18:31:09.068+0000","created":"2011-03-31T18:31:09.068+0000"}[root@candlepin1 ~]#

Comment 1 Devan Goodwin 2011-12-20 18:20:47 UTC
Not sure this is worth fixing, we would have to start communicating with the remote candlepin, outside the context of the asynchronous job, so we could report the error before starting the job, rather than the details on the job we're kicking off. 

To me this is working as I would expect, kick off the job, check it's status later and see if anything went wrong.

(dgoodwin@rhel6 ~/src) $ curl -k -u admin:admin -X POST "https://localhost:8443/candlepin/migrations?entity=owner&id=IDONTEXIST&uri=192.168.1.25:8080"

{"id":"migrate_owner_c782fc19-944d-4424-b42e-96fb3da14910","state":"CREATED","result":null,"targetType":null,"startTime":null,"group":"async group","principalName":"admin","targetId":null,"finishTime":null,"statusPath":"/jobs/migrate_owner_c782fc19-944d-4424-b42e-96fb3da14910","updated":"2011-12-20T18:18:36.095+0000","created":"2011-12-20T18:18:36.095+0000"}%

(dgoodwin@rhel6 ~/src) $ curl -k -u admin:admin "http://localhost:8080/candlepin/jobs/migrate_owner_c782fc19-944d-4424-b42e-96fb3da14910"

{"id":"migrate_owner_c782fc19-944d-4424-b42e-96fb3da14910","state":"FAILED","result":"org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.candlepin.exceptions.NotFoundException: Can't find owner [IDONTEXIST]]","targetType":null,"startTime":"2011-12-20T18:18:36.112+0000","group":"async group","principalName":"admin","targetId":null,"finishTime":null,"statusPath":"/jobs/migrate_owner_c782fc19-944d-4424-b42e-96fb3da14910","updated":"2011-12-20T18:18:36.194+0000","created":"2011-12-20T18:18:36.095+0000"}%                                                               

Anyone else have thoughts?

Comment 2 Jesus M. Rodriguez 2011-12-20 18:31:27 UTC
+1 to working as designed. We could add throwing JobExecutionException code to the execute method of the job, to update the cp_jobs table with a status.
But beyond that we are NOT giving errors to the console.

The PinsetterJobListener will take the value from the context and exception message and update the job as failed.

Comment 3 Devan Goodwin 2011-12-20 18:50:38 UTC
Going to close for now.