diff options
author | Qi Wang <qiwan@redhat.com> | 2019-10-25 21:16:37 -0400 |
---|---|---|
committer | Qi Wang <qiwan@redhat.com> | 2019-11-05 21:32:18 -0500 |
commit | d7c0f968ca60994306c8c76cd8e4e0a677fe9ada (patch) | |
tree | 3eff712a3fbb1c58eac9d7e43a55588a56d67892 /cmd/podman/run.go | |
parent | b4b727256c728295e6a3fcb69593347df9e90b23 (diff) | |
download | podman-d7c0f968ca60994306c8c76cd8e4e0a677fe9ada.tar.gz podman-d7c0f968ca60994306c8c76cd8e4e0a677fe9ada.tar.bz2 podman-d7c0f968ca60994306c8c76cd8e4e0a677fe9ada.zip |
fix bug check nonexist authfile
Use GetDefaultAuthFile() from buildah.
For podman command(except login), if authfile does not exist returns error.
close #4328
Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'cmd/podman/run.go')
-rw-r--r-- | cmd/podman/run.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go index 7aa4cb3c4..a6468f225 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -1,6 +1,8 @@ package main import ( + "os" + "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/pkg/adapter" "github.com/opentracing/opentracing-go" @@ -45,6 +47,11 @@ func runCmd(c *cliconfig.RunValues) error { span, _ := opentracing.StartSpanFromContext(Ctx, "runCmd") defer span.Finish() } + if c.String("authfile") != "" { + if _, err := os.Stat(c.String("authfile")); err != nil { + return errors.Wrapf(err, "error checking authfile path %s", c.String("authfile")) + } + } if err := createInit(&c.PodmanCommand); err != nil { return err } |