From 6f08e6c3d12d0b4de2a1b9281042e6b3cce28733 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 25 Apr 2019 13:28:07 -0400 Subject: fix login supports credHelpers config Skip the error if login can't find credentials in credHelpers with credHelpers configed in auth.json and podman login will store the credentials in credHelpers later. Signed-off-by: Qi Wang --- cmd/podman/login.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd/podman') diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 589255683..6bf148cca 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -11,6 +11,7 @@ import ( "github.com/containers/image/types" "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/libpod/image" + "github.com/docker/docker-credential-helpers/credentials" "github.com/pkg/errors" "github.com/spf13/cobra" "golang.org/x/crypto/ssh/terminal" @@ -90,7 +91,8 @@ func loginCmd(c *cliconfig.LoginValues) error { // username of user logged in to server (if one exists) userFromAuthFile, passFromAuthFile, err := config.GetAuthentication(sc, server) - if err != nil { + // Do not return error if no credentials found in credHelpers, new credentials will be stored by config.SetAuthentication + if err != nil && err != credentials.NewErrCredentialsNotFound() { return errors.Wrapf(err, "error reading auth file") } -- cgit v1.2.3-54-g00ecf