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

This commit is contained in:
Diptanu Choudhury 2015-10-26 19:52:32 -07:00
parent 1e240b5c59
commit 471442e9a4
1 changed files with 3 additions and 1 deletions

View File

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