make responses more meaningful
This commit is contained in:
@@ -23,7 +23,8 @@ do
|
||||
output_name+='.exe'
|
||||
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
|
||||
if [ $? -ne 0 ]; then
|
||||
echo 'An error has occurred! Aborting the script execution...'
|
||||
|
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user