make responses more meaningful
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-09-16 12:18:47 +10:00
parent afb85ff34a
commit d2aac0c6d4
2 changed files with 9 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
if event.CloudEvent.Data.ConfigChanges == nil {
h.Logger.Warn("Received event contains no config change")
prettyPrint(event)
w.WriteHeader(http.StatusAccepted)
fmt.Fprintf(w, "Processed update event but no config changes were found\n")
} else {
h.Logger.Debug("Received event contains config change info")
configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified)
@@ -83,8 +85,12 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
} else {
h.Logger.Debug("created database record", "insert_result", result)
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "Update Request (%d): %v\n", len(reqBody), string(reqBody))
fmt.Fprintf(w, "Processed update event: %v\n", result)
return
}
} else {
w.WriteHeader(http.StatusAccepted)
fmt.Fprintf(w, "Processed update event but no config changes were of interest\n")
}
}
}