From 3bc6df5f0e85aa509fcb197b96e1ec529aad5cbc Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 4 Oct 2017 21:41:27 -0700 Subject: [PATCH] Adds script warning and fixes Docker args recognition. --- agent/agent.go | 5 +++++ agent/structs/check_type.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/agent/agent.go b/agent/agent.go index a58c8a940d..c63477670a 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -1697,6 +1697,11 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *structs.CheckType, check.CheckID, MinInterval)) chkType.Interval = MinInterval } + if chkType.Script != "" { + a.logger.Printf("[WARN] agent: check %q has the 'script' field, which has been deprecated "+ + "and replaced with the 'args' field. See https://www.consul.io/docs/agent/checks.html", + check.CheckID) + } if a.dockerClient == nil { dc, err := NewDockerClient(os.Getenv("DOCKER_HOST"), CheckBufSize) diff --git a/agent/structs/check_type.go b/agent/structs/check_type.go index 9455f451a5..2f4c8a3698 100644 --- a/agent/structs/check_type.go +++ b/agent/structs/check_type.go @@ -75,5 +75,5 @@ func (c *CheckType) IsTCP() bool { // IsDocker returns true when checking a docker container. func (c *CheckType) IsDocker() bool { - return c.DockerContainerID != "" && c.Script != "" && c.Interval != 0 + return c.IsScript() && c.DockerContainerID != "" && c.Interval != 0 }