summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-05 21:57:48 +0200
committerGitHub <noreply@github.com>2020-08-05 21:57:48 +0200
commitbae6d5ddafb9d293702fda368587caae22fc3c80 (patch)
tree3b4ef118cda4784020565d2bfbc6a51e13964f21 /libpod
parentd1aaf3362204f860267e2bb58ec419b25edc5800 (diff)
parent7a64ce35db378e69b813aab7f026f11fbaf7e7f9 (diff)
downloadpodman-bae6d5ddafb9d293702fda368587caae22fc3c80.tar.gz
podman-bae6d5ddafb9d293702fda368587caae22fc3c80.tar.bz2
podman-bae6d5ddafb9d293702fda368587caae22fc3c80.zip
Merge pull request #7236 from mheon/write_error_to_inspect
Ensure that exec errors write exit codes to the DB
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_exec.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/container_exec.go b/libpod/container_exec.go
index 08e95e6dd..bfeae0a11 100644
--- a/libpod/container_exec.go
+++ b/libpod/container_exec.go
@@ -415,6 +415,13 @@ func (c *Container) ExecHTTPStartAndAttach(sessionID string, httpCon net.Conn, h
execOpts, err := prepareForExec(c, session)
if err != nil {
+ session.State = define.ExecStateStopped
+ session.ExitCode = define.ExecErrorCodeGeneric
+
+ if err := c.save(); err != nil {
+ logrus.Errorf("Error saving container %s exec session %s after failure to prepare: %v", err, c.ID(), session.ID())
+ }
+
return err
}
@@ -427,6 +434,13 @@ func (c *Container) ExecHTTPStartAndAttach(sessionID string, httpCon net.Conn, h
pid, attachChan, err := c.ociRuntime.ExecContainerHTTP(c, session.ID(), execOpts, httpCon, httpBuf, streams, cancel)
if err != nil {
+ session.State = define.ExecStateStopped
+ session.ExitCode = define.TranslateExecErrorToExitCode(define.ExecErrorCodeGeneric, err)
+
+ if err := c.save(); err != nil {
+ logrus.Errorf("Error saving container %s exec session %s after failure to start: %v", err, c.ID(), session.ID())
+ }
+
return err
}