Bug #32776
Host api request fails when thin=true and per_page=all
Difficulty:
Triaged:
No
Bugzilla link:
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1969263
Description of problem: Host api with per_page=all and thin=true raise an error. here is sample curl request
- curl -u admin:Password 'https://satellite.example.com/api/v2/hosts?per_page=all&thin=true&page=2'
{
"error": {"message":"Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."}
}
Version-Release number of selected component (if applicable): Satelliete 6.9
How reproducible: Always
Steps to Reproduce:
1. Log in to the satellite
2. Access the API https://satellite.example.com/api/v2/hosts?per_page=all&thin=true&page=2
Actual results: fails with error
Expected results: It should return host record
Additional info: This issue is only in satellite 6.9
Related issues
Associated revisions
History
#1
Updated by Tomer Brisker almost 2 years ago
- Related to Refactor #29909: Support fetching all records in API added
#2
Updated by Dominik Matoulek almost 2 years ago
- Assignee set to Dominik Matoulek
#3
Updated by The Foreman Bot almost 2 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/8595 added
#4
Updated by The Foreman Bot almost 2 years ago
- Fixed in Releases 3.0.0 added
#5
Updated by The Foreman Bot almost 2 years ago
- Fixed in Releases deleted (
3.0.0)
#6
Updated by Tomer Brisker almost 2 years ago
- Fixed in Releases 3.0.0 added
#7
Updated by Dominik Matoulek almost 2 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman|52a3d1ee7a68c36cdf1f5bb8b6c99f25b1dab539.
#8
Updated by The Foreman Bot almost 2 years ago
- Pull request https://github.com/theforeman/foreman/pull/8616 added
#9
Updated by Tomer Brisker almost 2 years ago
- Target version set to 2.5.1
#10
Updated by Tomer Brisker almost 2 years ago
- Fixed in Releases 2.5.1 added
Fixes #32776 - Fixing subtotal count at Hosts controller
Foreman uses will_paginate gem for pagination. When the user wants
all results in one page by API, this gem is not used.
That causes interferences with thin parameter at the Hosts controller.
When the thin parameter is used there method call 'total_entries' that
is method from will_paginate gem. It's works great until user wants all
results in page. In that case will_paginate gem is not used. Logically
is causes NoMethodError. This PR fixes it by calling size instead.