mirror of
https://github.com/containers/podman
synced 2024-10-20 17:23:30 +00:00
oci: improve error message when the OCI runtime is not found
We were previously returning the not so nice error directly from conmon. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
05450f3162
commit
446d333783
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue