Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit c7ae679

Browse files
authored
Merge pull request #358 from thaJeztah/19.03_backport_exec_failure_event
[19.03 backport] Send exec exit event on failures Upstream-commit: 879fba29d54b4403bb11cc69fa0ba9b6b4aca7c2 Component: engine
2 parents 6a94234 + 36d6bc9 commit c7ae679

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

components/engine/daemon/monitor.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei
117117
return cpErr
118118
}
119119

120+
exitCode := 127
120121
if execConfig := c.ExecCommands.Get(ei.ProcessID); execConfig != nil {
121122
ec := int(ei.ExitCode)
122123
execConfig.Lock()
@@ -131,18 +132,14 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei
131132
// remove the exec command from the container's store only and not the
132133
// daemon's store so that the exec command can be inspected.
133134
c.ExecCommands.Delete(execConfig.ID, execConfig.Pid)
134-
attributes := map[string]string{
135-
"execID": execConfig.ID,
136-
"exitCode": strconv.Itoa(ec),
137-
}
138-
daemon.LogContainerEventWithAttributes(c, "exec_die", attributes)
139-
} else {
140-
logrus.WithFields(logrus.Fields{
141-
"container": c.ID,
142-
"exec-id": ei.ProcessID,
143-
"exec-pid": ei.Pid,
144-
}).Warn("Ignoring Exit Event, no such exec command found")
135+
136+
exitCode = ec
137+
}
138+
attributes := map[string]string{
139+
"execID": ei.ProcessID,
140+
"exitCode": strconv.Itoa(exitCode),
145141
}
142+
daemon.LogContainerEventWithAttributes(c, "exec_die", attributes)
146143
case libcontainerdtypes.EventStart:
147144
c.Lock()
148145
defer c.Unlock()

0 commit comments

Comments
 (0)