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

add comment

parent 9a0c3ed6
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,7 @@ func renderPage(w http.ResponseWriter, req *http.Request) {
// trigger puppet
func triggerPuppet(w http.ResponseWriter, req *http.Request) {
// content-type is currently not working
cmd := exec.Command("/usr/bin/pkill", "-f", "/opt/puppetlabs/puppet/bin/puppet", "--signal", "SIGUSR1")
authToken := "BOFH"
_, ok := req.Header["Authorization"]
......@@ -79,8 +80,7 @@ func triggerPuppet(w http.ResponseWriter, req *http.Request) {
unauthorizedMsg := fmt.Sprintln("{\n \"status\": \"Unauthorized\",\n \"response\": 401\n}")
unavailableMsg := fmt.Sprintln("{\n \"status\": \"KO\",\n \"response\": 503\n}")
req.Header.Add("Content-Type", "application/json")
//w.Header().Set("Content-Type", "application/json")
w.Header().Set("Content-Type", "application/json; charset=utf-8")
if authToken != bearerToken {
http.Error(w, unauthorizedMsg, http.StatusUnauthorized)
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment