diff options
author | TomSweeneyRedHat <tsweeney@redhat.com> | 2018-10-16 17:58:12 -0400 |
---|---|---|
committer | TomSweeneyRedHat <tsweeney@redhat.com> | 2018-10-22 19:20:34 -0400 |
commit | e75b3477ce2acf8af49a13e8197401ee00bff459 (patch) | |
tree | 9682264be226052e9ccc4327e3d55e8097c690dc /cmd/podman/login.go | |
parent | 5b2478ed87eedd8178c1672a786f95a6716a8edb (diff) | |
download | podman-e75b3477ce2acf8af49a13e8197401ee00bff459.tar.gz podman-e75b3477ce2acf8af49a13e8197401ee00bff459.tar.bz2 podman-e75b3477ce2acf8af49a13e8197401ee00bff459.zip |
Handle http/https in registry given to login/out
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Diffstat (limited to 'cmd/podman/login.go')
-rw-r--r-- | cmd/podman/login.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 76f0f50ff..aa26d1466 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -60,10 +60,7 @@ func loginCmd(c *cli.Context) error { if len(args) == 0 { return errors.Errorf("registry must be given") } - var server string - if len(args) == 1 { - server = args[0] - } + server := scrubServer(args[0]) authfile := getAuthFile(c.String("authfile")) sc := common.GetSystemContext("", authfile, false) @@ -113,6 +110,10 @@ func getUserAndPass(username, password, userFromAuthFile string) (string, string if err != nil { return "", "", errors.Wrapf(err, "error reading username") } + // If no username provided, use userFromAuthFile instead. + if strings.TrimSpace(username) == "" { + username = userFromAuthFile + } } if password == "" { fmt.Print("Password: ") |