Reproducer:
[root@dhcp207-190 fdi-image]# curl -i -k -u admin:changeme -H "Accept: application/json" -X GET 'https://dhcp207-190.lab.eng.pnq.redhat.com/api/v2/discovered_hosts/'
HTTP/1.1 200 OK
Status: 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
{
"total": 1,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"name":"mac52540054c6e2","id":4,"ip":"192.168.100.11","mac":"52:54:00:54:c6:e2","last_report":"2015-03-03T05:55:53Z","subnet_id":1,"subnet_name":"libvirt","memory":995,"disk_count":1,"disks_size":8192,"cpus":1,"organization_id":1,"organization_name":"Default Organization","location_id":2,"location_name":"Default Location"}]
}
---
Next, I tried to provision it:
[root@dhcp207-190 fdi-image]# curl -i -k -u admin:changeme -H "Content-Type: application/json" -X PUT 'https://dhcp207-190.lab.eng.pnq.redhat.com/api/v2/discovered_hosts/4'
HTTP/1.1 500 Internal Server Error
Status: 500 Internal Server Error
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
{
"error": {"message":"undefined method `boot_filename' for nil:NilClass"}
}
We should give a nice error.
For the record: this patch (which was NOT merged) fixes this, but it is not clean. We should somehow detect earlier that OS was not set and raise a nicer error instead.