| Summary: | API host PUT uses fields not in host hash as filter | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> |
| Component: | Hosts | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.2.2 | CC: | bbuckingham, inecas, jcallaha |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-08 15:51:44 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | |||
| Bug Blocks: | 1122832 | ||
Closing, with 6.2.10 the filtering works reliable and consistent. It first uses the environment_id for filtering and then will search for the host. If the provided environment does not exists then it gives an error that does not exists
Correct environment_id and host_id
[crash/LI] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"environment_id\":\"503\"}" -XPUT https://localhost:443/api/v2/hosts/3 | jq .id
3
Hosts is not in environment_id 503
[crash/LI] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"environment_id\":\"503\"}" -XPUT https://localhost:443/api/v2/hosts/7
{
"error": {"message":"Resource host not found by id '7'"}
}
Environment does not exists
[crash/LI] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"environment_id\":\"99503\"}" -XPUT https://localhost:443/api/v2/hosts/7
{"message":"Environment not found by id '99503'"}
|
Description of problem: I got the following undocumented feature that setting the environment_id not inside the require host hash then it will be used for filtering. See the commands below, when i specify the current environment_id in the PUT i get a result. When i specify a different environment_id then it returns a resource not found [prod] root@li-lp-1800:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"environment_id\":\"71\"}" -XPUT https://localhost:443/api/v2/hosts/107 | jq .environment_id 71 [prod] root@li-lp-1800:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"environment_id\":\"70\"}" -XPUT https://localhost:443/api/v2/hosts/107 { "error": {"message":"Resource host not found by id '107'"} } Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. PUT a hosts with a value of environment_id that is different from the current one, but not inside the host:{} hash 2. 3. Actual results: Error resource not found. Expected results: Value of environment_id is ignore or an error is given that an unsupported field is passed. Additional info: