summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorSascha Grunert <sgrunert@suse.com>2019-07-30 13:24:02 +0200
committerSascha Grunert <sgrunert@suse.com>2019-08-01 08:32:25 +0200
commit7dfaef7766871e5fd914eb0373b26db29df5bb46 (patch)
tree8a321b2b5a98b90e6054b9027f3b7f4ea61474a0 /libpod/oci.go
parenta622f8d345b1853401de2e533e9fbf14ef169fa2 (diff)
downloadpodman-7dfaef7766871e5fd914eb0373b26db29df5bb46.tar.gz
podman-7dfaef7766871e5fd914eb0373b26db29df5bb46.tar.bz2
podman-7dfaef7766871e5fd914eb0373b26db29df5bb46.zip
Add runtime and conmon path discovery
The `$PATH` environment variable will now used as fallback if no valid runtime or conmon path matches. The debug logs has been updated to state the used executable. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index 193e66aaf..2eb004b84 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -106,8 +106,19 @@ func newOCIRuntime(name string, paths []string, conmonPath string, runtimeCfg *R
}
foundPath = true
runtime.path = path
+ logrus.Debugf("using runtime %q", path)
break
}
+
+ // Search the $PATH as last fallback
+ if !foundPath {
+ if foundRuntime, err := exec.LookPath(name); err == nil {
+ foundPath = true
+ runtime.path = foundRuntime
+ logrus.Debugf("using runtime %q from $PATH: %q", name, foundRuntime)
+ }
+ }
+
if !foundPath {
return nil, errors.Wrapf(define.ErrInvalidArg, "no valid executable found for OCI runtime %s", name)
}