Updated invalid check error message.

Added some of the newer reasons this error could have occured.
This commit is contained in:
Ryan Slade 2016-01-27 18:20:19 +02:00
parent b7c502c15a
commit 37c7a0e006
1 changed files with 4 additions and 2 deletions

View File

@ -78,6 +78,8 @@ func (s *HTTPServer) AgentForceLeave(resp http.ResponseWriter, req *http.Request
return nil, s.agent.ForceLeave(addr) return nil, s.agent.ForceLeave(addr)
} }
const invalidCheckMessage = "Must provide TTL or Script/DockerContainerID/HTTP/TCP and Interval"
func (s *HTTPServer) AgentRegisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error) { func (s *HTTPServer) AgentRegisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
var args CheckDefinition var args CheckDefinition
// Fixup the type decode of TTL or Interval // Fixup the type decode of TTL or Interval
@ -110,7 +112,7 @@ func (s *HTTPServer) AgentRegisterCheck(resp http.ResponseWriter, req *http.Requ
chkType := &args.CheckType chkType := &args.CheckType
if !chkType.Valid() { if !chkType.Valid() {
resp.WriteHeader(400) resp.WriteHeader(400)
resp.Write([]byte("Must provide TTL or Script and Interval!")) resp.Write([]byte(invalidCheckMessage))
return nil, nil return nil, nil
} }
@ -220,7 +222,7 @@ func (s *HTTPServer) AgentRegisterService(resp http.ResponseWriter, req *http.Re
} }
if !check.Valid() { if !check.Valid() {
resp.WriteHeader(400) resp.WriteHeader(400)
resp.Write([]byte("Must provide TTL or Script and Interval!")) resp.Write([]byte(invalidCheckMessage))
return nil, nil return nil, nil
} }
} }