BUGFIX: If runtime cannot be found, error out

In the case where the runtime cannot be found, kpod should error
out.  This occurs in kpod ps when iterating through the containers
to get details.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude 2017-09-21 09:55:56 -05:00
parent af692f611d
commit 73b9e4c430

View file

@ -4,6 +4,7 @@ import (
"os"
"strings"
"fmt"
is "github.com/containers/image/storage"
"github.com/containers/storage"
"github.com/fatih/camelcase"
@ -93,6 +94,10 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) {
if c.GlobalIsSet("runtime") {
config.Runtime = c.GlobalString("runtime")
}
if _, err := os.Stat(config.Runtime); os.IsNotExist(err) {
// path to runtime does not exist
return config, fmt.Errorf("invalid --runtime value %q", err)
}
return config, nil
}