Allow password for docker registry to be inputted silently

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
This commit is contained in:
Ryan Cole 2017-08-04 09:04:52 -04:00
parent 44e3b8de67
commit 0d8f015675
8 changed files with 1297 additions and 3 deletions

View file

@ -10,6 +10,7 @@ import (
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
"github.com/pkg/errors"
"github.com/urfave/cli"
"golang.org/x/crypto/ssh/terminal"
)
var (
@ -88,7 +89,16 @@ func pushCmd(c *cli.Context) error {
if registryCredsString != "" {
creds, err := common.ParseRegistryCreds(registryCredsString)
if err != nil {
return err
if err == common.ErrNoPassword {
fmt.Print("Password: ")
password, err := terminal.ReadPassword(0)
if err != nil {
return errors.Wrapf(err, "could not read password from terminal")
}
creds.Password = string(password)
} else {
return err
}
}
registryCreds = creds
}