mirror of https://github.com/docker/docs.git
Merge pull request #2444 from dongluochen/containerRefresh
Listen to health_status events
This commit is contained in:
commit
5e2ae22513
|
@ -714,9 +714,8 @@ func (e *Engine) refreshVolume(IDOrName string) error {
|
|||
delete(e.volumes, IDOrName)
|
||||
e.Unlock()
|
||||
return nil
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
e.Lock()
|
||||
|
@ -1254,8 +1253,13 @@ func (e *Engine) handler(msg events.Message) error {
|
|||
case "image":
|
||||
e.RefreshImages()
|
||||
case "container":
|
||||
switch msg.Action {
|
||||
case "die", "kill", "oom", "pause", "start", "restart", "stop", "unpause", "rename", "update":
|
||||
action := msg.Action
|
||||
// healthcheck events are like 'health_status: unhealthy'
|
||||
if strings.HasPrefix(action, "health_status") {
|
||||
action = "health_status"
|
||||
}
|
||||
switch action {
|
||||
case "die", "kill", "oom", "pause", "start", "restart", "stop", "unpause", "rename", "update", "health_status":
|
||||
e.refreshContainer(msg.ID, true)
|
||||
default:
|
||||
e.refreshContainer(msg.ID, false)
|
||||
|
|
|
@ -185,6 +185,7 @@ function containerRunning() {
|
|||
# Bring up one manager, make sure it becomes primary.
|
||||
swarm_manage --replication --replication-ttl "4s" --advertise 127.0.0.1:$SWARM_BASE_PORT "$NODE_1_URL"
|
||||
run docker -H ${SWARM_HOSTS[0]} info
|
||||
echo "$output"
|
||||
[[ "${output}" == *"Role: primary"* ]]
|
||||
|
||||
# Fire up a second manager. Ensure it's a replica forwarding to the right primary.
|
||||
|
|
Loading…
Reference in New Issue