Skip to content

Commit

Permalink
Update for ErrUnauthorizedForCredentials API change in containers/image
Browse files Browse the repository at this point in the history
Replace an equality check with a type assertion when checking for a
docker.ErrUnauthorizedForCredentials in `podman login`.

Signed-off-by: Nalin Dahyabhai <[email protected]>

Closes: containers#1902
Approved by: rhatdan
  • Loading branch information
nalind authored and caiges committed Nov 12, 2019
1 parent 3b80cc3 commit 6de458a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/buildah/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/containers/image/v5/docker"
"github.com/containers/image/v5/pkg/docker/config"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
)
Expand Down Expand Up @@ -116,15 +117,15 @@ func loginCmd(c *cobra.Command, args []string, iopts *loginReply) error {
return err
}
}
switch err {
case nil:
if err == nil {
fmt.Println("Login Succeeded!")
return nil
case docker.ErrUnauthorizedForCredentials:
}
if unauthorized, ok := err.(docker.ErrUnauthorizedForCredentials); ok {
logrus.Debugf("error logging into %q: %v", server, unauthorized)
return errors.Errorf("error logging into %q: invalid username/password", server)
default:
return errors.Wrapf(err, "error authenticating creds for %q", server)
}
return errors.Wrapf(err, "error authenticating creds for %q", server)
}

// GetUserAndPass gets the username and password from STDIN if not given
Expand Down

0 comments on commit 6de458a

Please sign in to comment.