make responses more meaningful
This commit is contained in:
@@ -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...'
|
||||||
|
@@ -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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user