minor adjustments
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-02 08:29:49 +10:00
parent 3bc7f922d3
commit b9c1f65971
6 changed files with 41 additions and 16 deletions

View File

@@ -164,7 +164,14 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
if err != nil {
h.Logger.Error("unable to find existing inventory record for this VM", "error", err)
// TODO - how to handle?
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
json.NewEncoder(w).Encode(map[string]string{
"status": "ERROR",
"message": fmt.Sprintf("Valid request but could not locate vm id '%s' and datacenter name '%s' within inventory table : %s",
event.CloudEvent.Data.VM.VM.Value, event.CloudEvent.Data.Datacenter.Name, err),
})
return
} else {
params.InventoryId = sql.NullInt64{Int64: invResult.Iid, Valid: invResult.Iid > 0}
}