Hide Forgot
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:
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'"}