Bug 2073165

Summary: GET request on /api/fact_values and /api/hosts/:host_id/facts shows no results if using per_page=all in Satellite 6
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: FactAssignee: satellite6-bugs <satellite6-bugs>
Status: NEW --- QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.4CC: apatel, casl, mhulan, nalfassi
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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