Bug 1284556 - Pagination is ignored when requesting owner's entitlements
Summary: Pagination is ignored when requesting owner's entitlements
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.9
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: candlepin-bugs
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-23 15:07 UTC by Shayne Riley
Modified: 2015-12-01 07:25 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-01 07:25:12 UTC
Embargoed:


Attachments (Terms of Use)

Description Shayne Riley 2015-11-23 15:07:08 UTC
Description of problem:

It is possible to list all active entitlements for an owner with: GET /candlepin/owners/{ownerId}/entitlements

However, if the list of entitlements is too great, it is also possible (or so I was informed) to attach the following query in order to paginate through the entitlements: ?page=1&per_page=2

However, what I'm seeing is that the page and per_page query parameters are ignored, and ALL of the entitlements are returned, no matter what.



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


How reproducible:
Always


Steps to Reproduce:
1. Create (or find) an owner with at least two active entitlements. In stage, an owner fitting this constraint is 7624949.

2. Make a request to list entitlements, 1-per-page:
curl -ku $CPADMIN_USER:$CPADMIN_PASS -X GET 'http://candlepindomain/candlepin/owners/7624949/entitlements?page=1&per_page=1'

3. Count the number of entitlements returned by the request.


Actual results:
All four entitlements for owner 7624949 were returned.


Expected results:
Only the first entitlement (by creation date) should have been returned.


Additional info:
It's easier to count the results if you use jq (sudo yum install jq):

curl -ku $CPADMIN_USER:$CPADMIN_PASS -X GET 'http://candlepindomain/candlepin/owners/7624949/entitlements?page=1&per_page=1' | jq '. | length' -

(returns "4")

Comment 2 vritant 2015-12-01 07:25:12 UTC
This was fixed in Candlepin 2.0


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