summaryrefslogtreecommitdiff
path: root/cmd/podman/login.go
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2019-10-24 10:37:22 -0400
committerNalin Dahyabhai <nalin@redhat.com>2019-10-29 13:35:18 -0400
commita4a70b4506ec4abb8b3bbc3873ee5ca015a8ed08 (patch)
tree4e7a50576d4db83450c58054e276f33bbd2cdb3a /cmd/podman/login.go
parent59582c55b798f0a2d086981ca9a8ddd8314fd0c2 (diff)
downloadpodman-a4a70b4506ec4abb8b3bbc3873ee5ca015a8ed08.tar.gz
podman-a4a70b4506ec4abb8b3bbc3873ee5ca015a8ed08.tar.bz2
podman-a4a70b4506ec4abb8b3bbc3873ee5ca015a8ed08.zip
bump containers/image to v5.0.0, buildah to v1.11.4
Move to containers/image v5 and containers/buildah to v1.11.4. Replace an equality check with a type assertion when checking for a docker.ErrUnauthorizedForCredentials in `podman login`. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'cmd/podman/login.go')
-rw-r--r--cmd/podman/login.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/cmd/podman/login.go b/cmd/podman/login.go
index 96b4ac2a2..f91366eac 100644
--- a/cmd/podman/login.go
+++ b/cmd/podman/login.go
@@ -6,14 +6,15 @@ import (
"os"
"strings"
- "github.com/containers/image/v4/docker"
- "github.com/containers/image/v4/pkg/docker/config"
- "github.com/containers/image/v4/types"
+ "github.com/containers/image/v5/docker"
+ "github.com/containers/image/v5/pkg/docker/config"
+ "github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod/image"
"github.com/docker/docker-credential-helpers/credentials"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
)
@@ -134,15 +135,15 @@ func loginCmd(c *cliconfig.LoginValues) error {
return err
}
}
- switch err {
- case nil:
+ if err == nil {
fmt.Println("Login Succeeded!")
return nil
- case docker.ErrUnauthorizedForCredentials:
+ }
+ if unauthorizedError, ok := err.(docker.ErrUnauthorizedForCredentials); ok {
+ logrus.Debugf("error logging into %q: %v", server, unauthorizedError)
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