updated to better handle all responses from the provisioner as well as add more debugging information
Change-Id: I217df62b42c339b387f65bc6c6bf7a1bc56fa3ed
diff --git a/provisioner/handlers.go b/provisioner/handlers.go
index c2e78ba..6a7bb01 100644
--- a/provisioner/handlers.go
+++ b/provisioner/handlers.go
@@ -59,22 +59,26 @@
decoder := json.NewDecoder(r.Body)
defer r.Body.Close()
if err := decoder.Decode(&info); err != nil {
+ log.Printf("[error] Unable to decode request to provision : %s", err)
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
if !c.validateData(&info) {
+ log.Printf("[errpr] Provisioning request not valid for '%s'", info.Name)
w.WriteHeader(http.StatusBadRequest)
return
}
role, err := c.GetRole(&info)
if err != nil {
+ log.Printf("[error] unable to get provisioning role for node '%s' : %s", info.Name, err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
err = c.dispatcher.Dispatch(&info, role, c.config.Script)
if err != nil {
+ log.Printf("[errpr] unable to dispatch provisioning request for node '%s' : %s", info.Name, err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}