Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 201 forks source link

wrong http response code on successful userGroup creation #2908

Open LucaMH opened 1 month ago

LucaMH commented 1 month ago

Expected Behavior

when creating a userGroup via the http api and the object gets created successfully, the response code should be 201 Created

curl -k -s -u ''"$myuser"':'"$mypassword"'' -H 'Accept: application/json' -X POST 'https://icinga/icingaweb2/director/userGroup/add' -d '{ "object_name": "test1" , "object_type": "object" }' -v
[...]
< HTTP/1.1 201 Created
[...]

Current Behavior

when creating a userGroup via the http api, 500 Internal Server Error with "{"status":"error","message":"Not found"}" gets returned but object gets created as requested

curl -k -s -u ''"$myuser"':'"$mypassword"'' -H 'Accept: application/json' -X POST 'https://icinga/icingaweb2/director/userGroup/add' -d '{ "object_name": "test1" , "object_type": "object" }' -v
[...]
< HTTP/1.1 500 Internal Server Error
[...]
{"status":"error","message":"Not found"}

Possible Solution

fix message and responscode when object successfully got created

Steps to Reproduce (for bugs)

run

curl -k -s -u ''"$myuser"':'"$mypassword"'' -H 'Accept: application/json' -X POST 'https://icinga/icingaweb2/director/userGroup/add' -d '{ "object_name": "test1" , "object_type": "object" }' -v

and check the response code

Your Environment

tbauriedel commented 1 month ago

ref/NC/812677