summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-26 14:09:15 +0100
committerGitHub <noreply@github.com>2019-02-26 14:09:15 +0100
commit865fc27075cfcbf99b07567d85c0e3525c5ade17 (patch)
tree4adc03cf86f1d2230b24adaf3e99e5246597c988
parent05450f3162347b2d2b2f61559a6b8261f7dffec9 (diff)
parent446d333783e2ea3545eec35eb0cc4e3b3a168964 (diff)
downloadpodman-865fc27075cfcbf99b07567d85c0e3525c5ade17.tar.gz
podman-865fc27075cfcbf99b07567d85c0e3525c5ade17.tar.bz2
podman-865fc27075cfcbf99b07567d85c0e3525c5ade17.zip
Merge pull request #2437 from giuseppe/runtime-nice-error
oci: improve error message when the OCI runtime is not found
-rw-r--r--libpod/runtime.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 94dbf37dd..52f4523ba 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -526,6 +526,16 @@ func makeRuntime(runtime *Runtime) (err error) {
if runtime.config.OCIRuntime != "" && runtime.config.OCIRuntime[0] == '/' {
foundRuntime = true
runtime.ociRuntimePath = OCIRuntimePath{Name: filepath.Base(runtime.config.OCIRuntime), Paths: []string{runtime.config.OCIRuntime}}
+ stat, err := os.Stat(runtime.config.OCIRuntime)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return errors.Wrapf(err, "the specified OCI runtime %s does not exist", runtime.config.OCIRuntime)
+ }
+ return errors.Wrapf(err, "cannot stat the OCI runtime path %s", runtime.config.OCIRuntime)
+ }
+ if !stat.Mode().IsRegular() {
+ return fmt.Errorf("the specified OCI runtime %s is not a valid file", runtime.config.OCIRuntime)
+ }
} else {
// If not, look it up in the configuration.
paths := runtime.config.OCIRuntimes[runtime.config.OCIRuntime]