Bug #20891

API hosts/X/facts inconsistent and superfluous hostname hash in results response

Added by Daniel Lobato Garcia 14 days ago. Updated 4 days ago.

Status:New
Priority:Normal
Assigned To:-
Category:Facts
Target version:-
Difficulty:easy Bugzilla link:1489515
Found in release: Pull request:
Story points-
Velocity based estimate-

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1489515

Description of problem:
When querying the facts of a host the returned results are encapsulated in an additional hash of the hostname. This is inconsistent with all other API responses on a per host level, e.g. the interfaces

[crash/LI] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999999}" -XGET https://localhost:443/api/v2/hosts/23/facts {
"total": 217,
"subtotal": 1,
"page": 1,
"per_page": 9999999,
"search": " host = 23",
"sort": {
"by": null,
"order": null
},
"results": {"li-lc-1441.hag.hilti.com":{"hardwaremodel":"x86_64","architecture":"x86_64",...."rubyplatform":"x86_64-linux","package_provider":"yum"}}
}
[crash/LI] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999999}" -XGET https://localhost:443/api/v2/hosts/23/interfaces {
"total": 3,
"subtotal": 3,
"page": 1,
"per_page": 9999999,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"subnet_id":null,"subnet_name":null,"domain_id":1,...virtual":false}]
}

Steps to Reproduce:
1. Query hosts/X/facts
2. Query hosts/X/interfaces

Actual results:
Inconsistent return of results, the facst are inside results{"hostname":{}}
The interfaces are in the expected results:[]

Expected results:
Facts per hosts are directly underneath results returned like all other API calls.

History

#1 Updated by Marek Hulán 4 days ago

  • Subject changed from API hosts/X/facts inconsistent and superfluous hostname hash in results response to API hosts/X/facts inconsistent and superfluous hostname hash in results response
  • Category changed from Query interface to Facts
  • Difficulty set to easy

Also available in: Atom PDF