Merge branch 'master' of https://github.com/hashicorp/nomad
This commit is contained in:
commit
a73e1863d5
|
@ -248,7 +248,10 @@ func (c *ConsulService) performSync() {
|
|||
if _, ok := consulChecks[checkID]; !ok {
|
||||
host, port := trackedTask.task.FindHostAndPortFor(service.PortLabel)
|
||||
cr := c.makeCheck(serviceID, check, host, port)
|
||||
c.registerCheck(cr)
|
||||
if err := c.registerCheck(cr); err != nil {
|
||||
c.printLogMessage("[DEBUG] consul: error registering check %q: %v", cr.ID, err)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1240,14 +1240,18 @@ type ServiceCheck struct {
|
|||
func (sc *ServiceCheck) Validate() error {
|
||||
t := strings.ToLower(sc.Type)
|
||||
if t != ServiceCheckTCP && t != ServiceCheckHTTP {
|
||||
return fmt.Errorf("Check with name %v has invalid check type: %s ", sc.Name, sc.Type)
|
||||
return fmt.Errorf("service check must be either http or tcp type")
|
||||
}
|
||||
if sc.Type == ServiceCheckHTTP && sc.Path == "" {
|
||||
return fmt.Errorf("http checks needs the Http path information.")
|
||||
return fmt.Errorf("service checks of http type must have a valid http path")
|
||||
}
|
||||
|
||||
if sc.Type == ServiceCheckScript && sc.Script == "" {
|
||||
return fmt.Errorf("Script checks need the script to invoke")
|
||||
return fmt.Errorf("service checks of script type must have a valid script path")
|
||||
}
|
||||
|
||||
if sc.Interval <= 0 {
|
||||
return fmt.Errorf("service checks must have positive time intervals")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue