From 37c7a0e006f3552d2e08a0397bac789addf870a1 Mon Sep 17 00:00:00 2001 From: Ryan Slade Date: Wed, 27 Jan 2016 18:20:19 +0200 Subject: [PATCH] Updated invalid check error message. Added some of the newer reasons this error could have occured. --- command/agent/agent_endpoint.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command/agent/agent_endpoint.go b/command/agent/agent_endpoint.go index a816df8e9..8e4eb559c 100644 --- a/command/agent/agent_endpoint.go +++ b/command/agent/agent_endpoint.go @@ -78,6 +78,8 @@ func (s *HTTPServer) AgentForceLeave(resp http.ResponseWriter, req *http.Request 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) { var args CheckDefinition // 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 if !chkType.Valid() { resp.WriteHeader(400) - resp.Write([]byte("Must provide TTL or Script and Interval!")) + resp.Write([]byte(invalidCheckMessage)) return nil, nil } @@ -220,7 +222,7 @@ func (s *HTTPServer) AgentRegisterService(resp http.ResponseWriter, req *http.Re } if !check.Valid() { resp.WriteHeader(400) - resp.Write([]byte("Must provide TTL or Script and Interval!")) + resp.Write([]byte(invalidCheckMessage)) return nil, nil } }