Browse Source

Making an explicit check to test whether a check is of type Monitor

pull/1343/head
Diptanu Choudhury 9 years ago
parent
commit
471442e9a4
  1. 4
      command/agent/agent.go

4
command/agent/agent.go

@ -933,7 +933,7 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *CheckType, persist
} }
dockerCheck.Start() dockerCheck.Start()
a.checkDockers[check.CheckID] = dockerCheck a.checkDockers[check.CheckID] = dockerCheck
} else { } else if chkType.IsMonitor() {
if existing, ok := a.checkMonitors[check.CheckID]; ok { if existing, ok := a.checkMonitors[check.CheckID]; ok {
existing.Stop() existing.Stop()
} }
@ -952,6 +952,8 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *CheckType, persist
} }
monitor.Start() monitor.Start()
a.checkMonitors[check.CheckID] = monitor a.checkMonitors[check.CheckID] = monitor
} else {
return fmt.Errorf("Check type is not valid")
} }
} }

Loading…
Cancel
Save