Bug 1284556 - Pagination is ignored when requesting owner's entitlements
Pagination is ignored when requesting owner's entitlements
Product: Candlepin
Classification: Community
Component: candlepin (Show other bugs)
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: candlepin-bugs
Katello QA List
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2015-11-23 10:07 EST by Shayne Riley
Modified: 2015-12-01 02:25 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-12-01 02:25:12 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Shayne Riley 2015-11-23 10:07:08 EST
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):

How reproducible:

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 02:25:12 EST
This was fixed in Candlepin 2.0

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