mirror of https://github.com/docker/cli.git
cli/command/system: printServerWarnings: use client API version from info
Set the client's API version that's used in the info, instead of requesting it as part of printing. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
be307c5792
commit
da3871fd8e
|
@ -115,6 +115,7 @@ func runInfo(cmd *cobra.Command, dockerCli command.Cli, opts *infoOptions) error
|
|||
|
||||
if opts.format == "" {
|
||||
info.UserName = dockerCli.ConfigFile().AuthConfigs[registry.IndexServer].Username
|
||||
info.ClientInfo.APIVersion = dockerCli.CurrentVersion()
|
||||
return prettyPrintInfo(dockerCli, info)
|
||||
}
|
||||
return formatInfo(dockerCli, info, opts.format)
|
||||
|
@ -366,7 +367,7 @@ func prettyPrintServerInfo(dockerCli command.Cli, info *info) []error {
|
|||
|
||||
fmt.Fprint(dockerCli.Out(), "\n")
|
||||
|
||||
printServerWarnings(dockerCli, *info.Info)
|
||||
printServerWarnings(dockerCli, info)
|
||||
return errs
|
||||
}
|
||||
|
||||
|
@ -440,16 +441,16 @@ func printSwarmInfo(dockerCli command.Cli, info types.Info) {
|
|||
}
|
||||
}
|
||||
|
||||
func printServerWarnings(dockerCli command.Cli, info types.Info) {
|
||||
if versions.LessThan(dockerCli.Client().ClientVersion(), "1.42") {
|
||||
printSecurityOptionsWarnings(dockerCli, info)
|
||||
func printServerWarnings(dockerCli command.Cli, info *info) {
|
||||
if versions.LessThan(info.ClientInfo.APIVersion, "1.42") {
|
||||
printSecurityOptionsWarnings(dockerCli, *info.Info)
|
||||
}
|
||||
if len(info.Warnings) > 0 {
|
||||
fmt.Fprintln(dockerCli.Err(), strings.Join(info.Warnings, "\n"))
|
||||
return
|
||||
}
|
||||
// daemon didn't return warnings. Fallback to old behavior
|
||||
printServerWarningsLegacy(dockerCli, info)
|
||||
printServerWarningsLegacy(dockerCli, *info.Info)
|
||||
}
|
||||
|
||||
// printSecurityOptionsWarnings prints warnings based on the security options
|
||||
|
|
Loading…
Reference in New Issue