mirror of https://github.com/docker/cli.git
cli/command/system: prettyPrintServerInfo: simplify username
Starting with b4ca1c7368
, docker login
no longer depends on info.IndexServerAddress to determine the default
registry.
The prettyPrintServerInfo() still depended on this information, which
could potentially show the wrong information.
This patch changes it to also depend on the same information as docker login
now does.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
60d0659e40
commit
71fde20e17
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -319,12 +320,8 @@ func prettyPrintServerInfo(dockerCli command.Cli, info types.Info) []error {
|
|||
fprintlnNonEmpty(dockerCli.Out(), " HTTPS Proxy:", info.HTTPSProxy)
|
||||
fprintlnNonEmpty(dockerCli.Out(), " No Proxy:", info.NoProxy)
|
||||
|
||||
if info.IndexServerAddress != "" {
|
||||
u := dockerCli.ConfigFile().AuthConfigs[info.IndexServerAddress].Username
|
||||
if len(u) > 0 {
|
||||
fmt.Fprintln(dockerCli.Out(), " Username:", u)
|
||||
}
|
||||
}
|
||||
u := dockerCli.ConfigFile().AuthConfigs[registry.IndexServer].Username
|
||||
fprintlnNonEmpty(dockerCli.Out(), " Username:", u)
|
||||
|
||||
if len(info.Labels) > 0 {
|
||||
fmt.Fprintln(dockerCli.Out(), " Labels:")
|
||||
|
|
Loading…
Reference in New Issue