Bug 731577

Summary: RFE: Need API to query jobs by owner, target and principal
Product: [Community] Candlepin Reporter: Jordan OMara <jomara>
Component: candlepinAssignee: Jesus M. Rodriguez <jesusr>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.5CC: athomas, jesusr
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: 2012-07-17 13:03:17 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 Jordan OMara 2011-08-17 21:24:11 UTC
You guys have a /jobs API to query jobs by job id. You also save the owner, principal and target id in the jobs DB. However, you cannot query by these fields. We would like this feature so we can check when a particular org or consumer has an outstanding async job, so we can disable him from requesting another one. 

Example: 

/jobs/bind_by_pool_3545275d-8468-4c0b-b75d-b1462a906ffb

This returns exactly what we want - but at the time we need it in RHSM-WEB, we don't have access to the job id.

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

Thanks!

Comment 1 Jesus M. Rodriguez 2011-08-30 13:22:28 UTC
Fixed in 3bc5adcd7f8d094f3dedf2a7354efc0a06804b4f

Comment 2 Jesus M. Rodriguez 2011-08-30 13:23:09 UTC
To verify have pinsetter enabled and run the following curl commands:

Create a refresh job:
curl -k -u admin:admin -X PUT
https://localhost:8443/candlepin/owners/admin/subscriptions

Get back a list of the admin owned jobs (should return the above refresh
pools job):

curl -k -u admin:admin https://localhost:8443/candlepin/jobs/?owner=admin

Get back a list of the admin jobs by user (same as above):
curl -k -u admin:admin https://localhost:8443/candlepin/jobs/?principal=admin

Get back all the System jobs (should return all of the cron ones):
curl -k -u admin:admin https://localhost:8443/candlepin/jobs/?principal=System

Get back an empty list, basically no jobs exist for this principal:
curl -k -u admin:admin https://localhost:8443/candlepin/jobs/?principal=foo

Get back an error that you must specify some parameters:
curl -k -u admin:admin https://localhost:8443/candlepin/jobs/?principal=

Get back an error that you must specify only one of the parameters:
curl -k -u admin:admin
"https://localhost:8443/candlepin/jobs/?owner=admin&principal=foo&consumer=abcd"

Anything else you can think of.

Comment 3 Bryan Kearney 2012-07-17 13:03:17 UTC
Marking all community bugs modified or beyong as closed.