Send exec exit event on failures
| ... | ... |
@@ -118,6 +118,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei |
| 118 | 118 |
return cpErr |
| 119 | 119 |
} |
| 120 | 120 |
|
| 121 |
+ exitCode := 127 |
|
| 121 | 122 |
if execConfig := c.ExecCommands.Get(ei.ProcessID); execConfig != nil {
|
| 122 | 123 |
ec := int(ei.ExitCode) |
| 123 | 124 |
execConfig.Lock() |
| ... | ... |
@@ -135,18 +136,14 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei |
| 135 | 135 |
// remove the exec command from the container's store only and not the |
| 136 | 136 |
// daemon's store so that the exec command can be inspected. |
| 137 | 137 |
c.ExecCommands.Delete(execConfig.ID, execConfig.Pid) |
| 138 |
- attributes := map[string]string{
|
|
| 139 |
- "execID": execConfig.ID, |
|
| 140 |
- "exitCode": strconv.Itoa(ec), |
|
| 141 |
- } |
|
| 142 |
- daemon.LogContainerEventWithAttributes(c, "exec_die", attributes) |
|
| 143 |
- } else {
|
|
| 144 |
- logrus.WithFields(logrus.Fields{
|
|
| 145 |
- "container": c.ID, |
|
| 146 |
- "exec-id": ei.ProcessID, |
|
| 147 |
- "exec-pid": ei.Pid, |
|
| 148 |
- }).Warn("Ignoring Exit Event, no such exec command found")
|
|
| 138 |
+ |
|
| 139 |
+ exitCode = ec |
|
| 140 |
+ } |
|
| 141 |
+ attributes := map[string]string{
|
|
| 142 |
+ "execID": ei.ProcessID, |
|
| 143 |
+ "exitCode": strconv.Itoa(exitCode), |
|
| 149 | 144 |
} |
| 145 |
+ daemon.LogContainerEventWithAttributes(c, "exec_die", attributes) |
|
| 150 | 146 |
case libcontainerdtypes.EventStart: |
| 151 | 147 |
c.Lock() |
| 152 | 148 |
defer c.Unlock() |