updated to add persistence to provisioning and roll that through the rest of the services
Change-Id: Ia0d5a49dc0d88dbe6780c76483fd2247ad631bdf
diff --git a/provisioner/handlers.go b/provisioner/handlers.go
index 5bc6e57..7fd53fa 100644
--- a/provisioner/handlers.go
+++ b/provisioner/handlers.go
@@ -102,6 +102,24 @@
w.Write(bytes)
}
+func (c *Context) DeleteStatusHandler(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ id, ok := vars["nodeid"]
+ if !ok || strings.TrimSpace(id) == "" {
+ w.WriteHeader(http.StatusBadRequest)
+ return
+ }
+
+ err := c.storage.Delete(id)
+ if err != nil {
+ log.Printf("[warn] Error while deleting status fo '%s' from storage : %s", id, err)
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.WriteHeader(http.StatusOK)
+}
+
func (c *Context) QueryStatusHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id, ok := vars["nodeid"]