Skip to content

Commit 223d71a

Browse files
committed
cli/command/system/runInfo: set negotiated API version when available
The current logic was ignoring (e.g.) `--format=json` formats, and was only setting the negotiated API version if no format was specified. While we do want to avoid calling the API if possible, we do already check if the given template requires a server connection, so let's move updating the API version to that block. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent ce22ac2 commit 223d71a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cli/command/system/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ func runInfo(cmd *cobra.Command, dockerCli command.Cli, opts *infoOptions) error
111111
fprintln(dockerCli.Err(), err)
112112
}
113113
}
114+
info.ClientInfo.APIVersion = dockerCli.CurrentVersion()
114115
}
115116

116117
if opts.format == "" {
117118
info.UserName = dockerCli.ConfigFile().AuthConfigs[registry.IndexServer].Username
118-
info.ClientInfo.APIVersion = dockerCli.CurrentVersion()
119119
return prettyPrintInfo(dockerCli, info)
120120
}
121121
return formatInfo(dockerCli.Out(), info, opts.format)

0 commit comments

Comments
 (0)