Adds script warning and fixes Docker args recognition.

This commit is contained in:
James Phillips 2017-10-04 21:41:27 -07:00
parent b61ec82b2f
commit 97b580f593
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
2 changed files with 6 additions and 1 deletions

View File

@ -1697,6 +1697,11 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *structs.CheckType,
check.CheckID, MinInterval)) check.CheckID, MinInterval))
chkType.Interval = 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 { if a.dockerClient == nil {
dc, err := NewDockerClient(os.Getenv("DOCKER_HOST"), CheckBufSize) dc, err := NewDockerClient(os.Getenv("DOCKER_HOST"), CheckBufSize)

View File

@ -75,5 +75,5 @@ func (c *CheckType) IsTCP() bool {
// IsDocker returns true when checking a docker container. // IsDocker returns true when checking a docker container.
func (c *CheckType) IsDocker() bool { func (c *CheckType) IsDocker() bool {
return c.DockerContainerID != "" && c.Script != "" && c.Interval != 0 return c.IsScript() && c.DockerContainerID != "" && c.Interval != 0
} }