Bug #20940
closedAPI /api/hosts/:id returns inconsistent set of interfaces flags
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1489486
Description of problem:
API host interfaces response is confusing, when querying it on hosts level the interfaces array returns the field "primary" and "provision", but not the other option fields.
The /api/hosts/:id/interfaces level returns all the fields as expected.
That the /api/hosts/:id interfaces array returns only 2 out of the 5 flag fields is confusing for the user why e.g. the "managed" field is not returned.
If the /api/hosts/:id interfaces array would not have returned any flags then it would be better because then as a user i would be triggered to use the /api/hosts/:id/interfaces API call instead
[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 | jq .interfaces [ { "id": 67, "name": "li-lc-1441.hag.hilti.com", "ip": "10.92.14.89", "mac": "00:50:56:97:44:75", "identifier": "ens192", "primary": true, "provision": true, "type": "interface" }, { "id": 66, "name": "", "ip": "10.92.65.49", "mac": "00:50:56:97:00:80", "identifier": "ens224", "primary": false, "provision": false, "type": "interface" }, { "id": 65, "name": "", "ip": null, "mac": "00:50:56:97:4b:9a", "identifier": "ens32", "primary": false, "provision": false, "type": "interface" } ] [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 | jq . { "total": 3, "subtotal": 3, "page": 1, "per_page": 9999999, "search": null, "sort": { "by": null, "order": null }, "results": [ { "subnet_id": 3, "subnet_name": "install6-crash", "domain_id": 1, "domain_name": "hag.hilti.com", "created_at": "2017-08-15 14:53:59 UTC", "updated_at": "2017-09-07 12:56:03 UTC", "managed": true, "identifier": "ens192", "id": 67, "name": "li-lc-1441.hag.hilti.com", "ip": "10.92.14.89", "mac": "00:50:56:97:44:75", "primary": true, "provision": true, "type": "interface", "virtual": false }, { "subnet_id": null, "subnet_name": null, "domain_id": 1, "domain_name": "hag.hilti.com", "created_at": "2017-08-15 14:53:55 UTC", "updated_at": "2017-09-07 12:11:06 UTC", "managed": true, "identifier": "ens32", "id": 65, "name": "", "ip": null, "mac": "00:50:56:97:4b:9a", "primary": false, "provision": false, "type": "interface", "virtual": false }, { "subnet_id": null, "subnet_name": null, "domain_id": null, "domain_name": null, "created_at": "2017-08-15 14:53:59 UTC", "updated_at": "2017-09-07 12:11:06 UTC", "managed": false, "identifier": "ens224", "id": 66, "name": "", "ip": "10.92.65.49", "mac": "00:50:56:97:00:80", "primary": false, "provision": false, "type": "interface", "virtual": false } ] }
Steps to Reproduce:
1. Query /api/v2/hosts/:id look at interfaces array
2.
3.
Actual results:
Interfaces array returned with only "primary" and "provision" flags.
Expected results:
Interfaces array returned with all or none of the flags (compare with /api/v2/hosts/:id/interfaces).
Updated by Tomáš Strachota over 7 years ago
- Subject changed from API /api/hosts/:id returns inconsistent set of interfaces flags to API /api/hosts/:id returns inconsistent set of interfaces flags
- Category changed from 19 to Network
- Target version set to 115
Updated by The Foreman Bot over 7 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/4853 added
Updated by Amit Karsale over 6 years ago
- Assignee set to Amit Karsale
- Difficulty set to trivial
- Triaged set to No
Updated by The Foreman Bot over 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/5981 added
Updated by Amit Karsale over 6 years ago
- Pull request deleted (
https://github.com/theforeman/foreman/pull/4853)
Updated by Ondřej Pražák over 6 years ago
- Status changed from Ready For Testing to Closed
- Fixed in Releases 1.20.0 added