http: parsing flags for node drain

This commit is contained in:
Armon Dadgar
2015-09-06 19:35:05 -07:00
parent 445b90895c
commit 63ae02a2f9

View File

@@ -2,6 +2,7 @@ package agent
import (
"net/http"
"strconv"
"strings"
"github.com/hashicorp/nomad/nomad/structs"
@@ -88,6 +89,16 @@ func (s *HTTPServer) nodeToggleDrain(resp http.ResponseWriter, req *http.Request
return nil, CodedError(405, ErrInvalidMethod)
}
// Get the enable value
enableRaw := req.URL.Query().Get("enable")
if enableRaw == "" {
return nil, CodedError(400, "missing enable value")
}
enable, err := strconv.ParseBool(enableRaw)
if err != nil {
return nil, CodedError(400, "invalid enable value")
}
// TODO
return nil, nil
}