Project

General

Profile

Bug #32776

Host api request fails when thin=true and per_page=all

Added by Tomer Brisker about 2 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Category:
Inventory
Target version:
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

  1. 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

Related to Foreman - Refactor #29909: Support fetching all records in APIClosed

Associated revisions

Revision 52a3d1ee (diff)
Added by Dominik Matoulek about 1 month ago

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.

History

#1 Updated by Tomer Brisker about 2 months ago

#2 Updated by Dominik Matoulek about 2 months ago

  • Assignee set to Dominik Matoulek

#3 Updated by The Foreman Bot about 2 months 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 about 1 month ago

  • Fixed in Releases 3.0.0 added

#5 Updated by The Foreman Bot about 1 month ago

  • Fixed in Releases deleted (3.0.0)

#6 Updated by Tomer Brisker about 1 month ago

  • Fixed in Releases 3.0.0 added

#7 Updated by Dominik Matoulek about 1 month ago

  • Status changed from Ready For Testing to Closed

#8 Updated by The Foreman Bot about 1 month ago

  • Pull request https://github.com/theforeman/foreman/pull/8616 added

#9 Updated by Tomer Brisker about 1 month ago

  • Target version set to 2.5.1

#10 Updated by Tomer Brisker about 1 month ago

  • Fixed in Releases 2.5.1 added

Also available in: Atom PDF