summaryrefslogtreecommitdiff
path: root/libpod/boltdb_state_internal.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-06-20 15:14:28 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-06-20 15:14:28 -0400
commitdf43bfe53dfa2ea6cdf6c37ba567894340799416 (patch)
treeeacf66853601fe799a018380de1898bf069dd688 /libpod/boltdb_state_internal.go
parent7377870641c0d2a3ee705970369fe42fcf8aa88d (diff)
downloadpodman-df43bfe53dfa2ea6cdf6c37ba567894340799416.tar.gz
podman-df43bfe53dfa2ea6cdf6c37ba567894340799416.tar.bz2
podman-df43bfe53dfa2ea6cdf6c37ba567894340799416.zip
Handle containers whose OCIRuntime fields are paths
Try and locate the right runtime by using the basename of the path. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r--libpod/boltdb_state_internal.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index 2ac1867aa..a4818f2c8 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -2,6 +2,7 @@ package libpod
import (
"bytes"
+ "path/filepath"
"runtime"
"strings"
@@ -307,7 +308,14 @@ func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, ctrsBkt *bolt.
if ctr.config.OCIRuntime == "" {
ctr.ociRuntime = s.runtime.defaultOCIRuntime
} else {
- ociRuntime, ok := s.runtime.ociRuntimes[ctr.config.OCIRuntime]
+ // Handle legacy containers which might use a literal path for
+ // their OCI runtime name.
+ runtimeName := ctr.config.OCIRuntime
+ if strings.HasPrefix(runtimeName, "/") {
+ runtimeName = filepath.Base(runtimeName)
+ }
+
+ ociRuntime, ok := s.runtime.ociRuntimes[runtimeName]
if !ok {
return errors.Wrapf(ErrInternal, "container %s was created with OCI runtime %s, but that runtime is not available in the current configuration", ctr.ID(), ctr.config.OCIRuntime)
}