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

@@ -23,7 +23,8 @@ do
output_name+='.exe' output_name+='.exe'
fi fi
echo "build commences" starttime=$(TZ=Australia/Sydney date +%Y-%m-%dT%T%z)
echo "build commences at $starttime"
env GOOS=$GOOS GOARCH=$GOARCH go build -trimpath -ldflags="-X main.sha1ver=$commit -X main.buildTime=$buildtime" -o build/$output_name $package env GOOS=$GOOS GOARCH=$GOARCH go build -trimpath -ldflags="-X main.sha1ver=$commit -X main.buildTime=$buildtime" -o build/$output_name $package
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...' echo 'An error has occurred! Aborting the script execution...'

View File

@@ -43,6 +43,8 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
if event.CloudEvent.Data.ConfigChanges == nil { if event.CloudEvent.Data.ConfigChanges == nil {
h.Logger.Warn("Received event contains no config change") h.Logger.Warn("Received event contains no config change")
prettyPrint(event) prettyPrint(event)
w.WriteHeader(http.StatusAccepted)
fmt.Fprintf(w, "Processed update event but no config changes were found\n")
} else { } else {
h.Logger.Debug("Received event contains config change info") h.Logger.Debug("Received event contains config change info")
configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified) configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified)
@@ -83,8 +85,12 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
} else { } else {
h.Logger.Debug("created database record", "insert_result", result) h.Logger.Debug("created database record", "insert_result", result)
w.WriteHeader(http.StatusOK) 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")
} }
} }
} }