Bug #20891
API hosts/X/facts inconsistent and superfluous hostname hash in results response
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.
Related issues
History
#1
Updated by Marek Hulán about 2 years 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 19 to Facts
- Difficulty set to easy
#2
Updated by Shira Maximov about 2 years ago
- Target version set to 113
- Assignee set to Shira Maximov
- Status changed from New to Assigned
#3
Updated by The Foreman Bot about 2 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/5003 added
#4
Updated by Tomer Brisker over 1 year ago
- Legacy Backlogs Release (now unused) set to 353
#5
Updated by Shira Maximov over 1 year ago
- % Done changed from 0 to 100
- Status changed from Ready For Testing to Closed
Applied in changeset 8ebbbecf36922c7a1f1c27610ddb1d14fe0467fa.
#6
Updated by Martin Bacovsky about 1 year ago
- Related to Bug #25167: Hammer error: Error: undefined method `collect’ for added
#7
Updated by Martin Bacovsky about 1 year ago
- Related to Bug #25188: API hosts/X/facts still inconsistent added
Fixes #20891 - Remove hostname from /hosts/x/facts results