Failed PUT leaves ghost object on server?

I’m trying to get the API to work - I think it almost works for me, but I have a strange problem: I tried to create a host object like this:

root@enlil:~/icinga/tools# curl -vv -X PUT -H 'Accept:application/json' -u root:5adf85042d7d937f --cacert /var/lib/icinga2/certs/ca.crt https://vogon.comind.io:5665/v1/objects/hosts/enlil
...
{"results":[{"code":500,"errors":["Error: Validation failed for object 'enlil' of type 'Host'; Attribute 'check_command': Attribute must not be empty.\nLocation: in /var/lib/icinga2/api/packages/_api/c7cb4fc3-57b3-44a3-aea4-ffac2f643d3e/conf.d/hosts/enlil.conf: 1:0-1:18"],"status":"Object could not be created."}]}

Which is fair enough, I suppose - the template referred to a non-existent check_command for some reason; so I changed it, but it still fails, and it seems to leave a ghost object somewhere, which I can’t find:

root@enlil:~/icinga/tools# curl -X PUT -H 'Accept:application/json' -u root:5adf85042d7d937f --cacert /var/lib/icinga2/certs/ca.crt https://vogon.comind.io:5665/v1/objects/hosts/enlil
{"results":[{"code":500,"errors":["Error: Validation failed for object 'enlil' of type 'Host'; Attribute 'check_command': Attribute must not be empty.\nLocation: in /var/lib/icinga2/api/packages/_api/c7cb4fc3-57b3-44a3-aea4-ffac2f643d3e/conf.d/hosts/enlil.conf: 1:0-1:18"],"status":"Object could not be created."}]}

root@enlil:~/icinga/tools# curl -X GET -H 'Accept:application/json' -u root:5adf85042d7d937f --cacert /var/lib/icinga2/certs/ca.crt https://vogon.comind.io:5665/v1/objects/hosts/enlil
{"error":404,"status":"No objects found."}

root@enlil:~/icinga/tools# ll /var/lib/icinga2/api/packages/_api/c7cb4fc3-57b3-44a3-aea4-ffac2f643d3e/conf.d/hosts/enlil.conf
ls: cannot access '/var/lib/icinga2/api/packages/_api/c7cb4fc3-57b3-44a3-aea4-ffac2f643d3e/conf.d/hosts/enlil.conf': No such file or directory

root@enlil:~/icinga/tools# curl -X PUT -H 'Accept:application/json' -u root:5adf85042d7d937f --cacert /var/lib/icinga2/certs/ca.crt https://vogon.comind.io:5665/v1/objects/hosts/enlil
{"results":[{"code":500,"errors":["Error: Object 'enlil' of type 'Host' re-defined: in /var/lib/icinga2/api/packages/_api/c7cb4fc3-57b3-44a3-aea4-ffac2f643d3e/conf.d/hosts/enlil.conf: 1:0-1:18; previous definition: in /var/lib/icinga2/api/packages/_api/c7cb4fc3-57b3-44a3-aea4-ffac2f643d3e/conf.d/hosts/enlil.conf: 1:0-1:18\nLocation: in /var/lib/icinga2/api/packages/_api/c7cb4fc3-57b3-44a3-aea4-ffac2f643d3e/conf.d/hosts/enlil.conf: 1:0-1:18"],"status":"Object could not be created."}]}
  • What is this host-object that doesn’t exist when I look for it with GET, but still exists enough that I can’t try to create it again?
  • And why is it complaining about check_command not being set, when it is set in the template?

Hello @j4nd3r53n!

Which template?

Best,
A/K

hi A/K

Thanks for getting back to me! Actually I figured out that I was just being stupid. Basically, the configurations in conf.d were not being loaded on the master, because I had disabled that when I ran icinga2 node wizard; once I had fixed that, it worked.