unioslo/nivlheim

Bug: The hostlist api will make an internal error if you try to update custom fields for nonexistent hosts

Closed this issue · 0 comments

The SQL statements here will fail if no matching row is found in hostinfo:
https://github.com/usit-gd/nivlheim/blob/master/server/service/api_hostlist_post.go#L151

  • Consider running each host in a separate transaction instead of running the entire thing in one transaction. Trying to update a host that doesn't exist shouldn't prevent the other hosts in the list from being updated.
  • When updating multiple hosts, if some of them don't exist, the API should give a notification but otherwise return a 2xx status code.