Bug 2073165 - GET request on /api/fact_values and /api/hosts/:host_id/facts shows no results if using per_page=all in Satellite 6
Summary: GET request on /api/fact_values and /api/hosts/:host_id/facts shows no result...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Fact
Version: 6.10.4
Hardware: All
OS: All
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-04-07 19:37 UTC by Sayan Das
Modified: 2023-05-22 16:21 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 31897 0 Normal New Headline api feature per_page=all doesn't work for all ressources 2022-04-07 19:37:23 UTC

Description Sayan Das 2022-04-07 19:37:24 UTC
Description of problem:

GET request on /api/fact_values and /api/hosts/:host_id/facts shows no results if using per_page=all but works fine if we use a positive integer i.e. per_page=10 or per_page=9999

They perhaps are part of the same underlying code as I can see both of them from https://satellite.example.com/apidoc/v2/fact_values/index.html

This problem is not present in the /api/hosts endpoint though. 

GET on /api/v2/hosts/?per_page=all and /api/v2/hosts/?per_page=10 will print exact same set of result if you have 10 systems .


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

Satellite 6.10 (all earlier versions of satellite)


How reproducible:

Always


Steps to Reproduce:
1. Install and configure a Satellite 6.10 and register a system with the same.

2. Run the following APIs against the ID of the registered system e.g. here it is 117

# curl -ku admin:password https://`hostname -f`/api/v2/hosts/117/facts?per_page=all

# curl -ku admin:password https://`hostname -f`/api/v2/hosts/117/facts?per_page=5



Actual results:

# curl -ku admin:RedHat1! https://`hostname -f`/api/v2/hosts/117/facts?per_page=all
{
  "total": 331,
  "subtotal": 0,
  "page": 1,
  "per_page": 331,
  "search": " host = 117",
  "sort": {
    "by": null,
    "order": null
  },
  "results": {}
}


# curl -ku admin:RedHat1! https://`hostname -f`/api/v2/hosts/117/facts?per_page=5
{
  "total": 331,
  "subtotal": 1,
  "page": 1,
  "per_page": 5,
  "search": " host = 117",
  "sort": {
    "by": null,
    "order": null
  },
  "results": {"rhel7.example.com":{"ansible_device_links::ids":null,"ansible_device_links::uuids":null,"ansible_device_links::masters":null,"ansible_device_links":null,"ansible_default_ipv4":null}}
}

Expected results:

The per_page=all should be able to list all the fact_names and values related to that host. 


Additional info:

There's a Redmine present already i.e. https://projects.theforeman.org/issues/31897

Comment 1 Sayan Das 2022-04-07 19:45:41 UTC
Adding to the initial request, Please check and fix all the GET API calls where "per_page=all" can be used to list all results ( as we mention this option in APIDOC ) .


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