Skip to content
Snippets Groups Projects
Unverified Commit da8b39ab authored by Max Adamo's avatar Max Adamo
Browse files

minor

parent 950d0011
Branches
Tags
No related merge requests found
......@@ -83,10 +83,11 @@ func triggerPuppet(w http.ResponseWriter, req *http.Request) {
authToken := strings.Split(req.Header.Get("Authorization"), "Bearer ")[1]
statusFile := "/tmp/200.json"
writeFile(fmt.Sprintf("{\n \"status\": \"OK\",\n \"response\": 200\n \"token\": %v\n}", authToken), "/tmp/200.json")
writeFile(fmt.Sprintf("{\n \"status\": \"KO\",\n \"response\": 503\n \"token\": %v\n}", authToken), "/tmp/503.json")
writeFile(fmt.Sprintf("{\n \"status\": \"KO\",\n \"response\": 401\n \"token\": %v\n}", authToken), "/tmp/503.json")
if authToken != bearerToken {
statusFile = "/tmp/503.json"
//w.WriteHeader(http.StatusUnauthorized)
statusFile = "/tmp/401.json"
w.WriteHeader(http.StatusUnauthorized)
http.ServeFile(w, req, statusFile)
} else {
cmd.Run()
if verboseBool {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment