api: generalize version information to any platform component
This change adds a Platform struct with a Name field and a general Components field to the Version API type. This will allow API consumers to show version information for the whole platform and it will allow API providers to set the versions for the various components of the platform. All changes here are backwards compatible. Signed-off-by: Tibor Vass <tibor@docker.com> Upstream-commit: 9152e63290e4a4e586b811cce39082efc649b912 Component: engine
This commit is contained in:
@@ -154,24 +154,46 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
||||
|
||||
// SystemVersion returns version information about the daemon.
|
||||
func (daemon *Daemon) SystemVersion() types.Version {
|
||||
v := types.Version{
|
||||
Version: dockerversion.Version,
|
||||
GitCommit: dockerversion.GitCommit,
|
||||
MinAPIVersion: api.MinVersion,
|
||||
GoVersion: runtime.Version(),
|
||||
Os: runtime.GOOS,
|
||||
Arch: runtime.GOARCH,
|
||||
BuildTime: dockerversion.BuildTime,
|
||||
Experimental: daemon.configStore.Experimental,
|
||||
}
|
||||
|
||||
kernelVersion := "<unknown>"
|
||||
if kv, err := kernel.GetKernelVersion(); err != nil {
|
||||
logrus.Warnf("Could not get kernel version: %v", err)
|
||||
} else {
|
||||
kernelVersion = kv.String()
|
||||
}
|
||||
v.KernelVersion = kernelVersion
|
||||
|
||||
v := types.Version{
|
||||
Components: []types.ComponentVersion{
|
||||
{
|
||||
Name: "Engine",
|
||||
Version: dockerversion.Version,
|
||||
Details: map[string]string{
|
||||
"GitCommit": dockerversion.GitCommit,
|
||||
"ApiVersion": api.DefaultVersion,
|
||||
"MinAPIVersion": api.MinVersion,
|
||||
"GoVersion": runtime.Version(),
|
||||
"Os": runtime.GOOS,
|
||||
"Arch": runtime.GOARCH,
|
||||
"BuildTime": dockerversion.BuildTime,
|
||||
"KernelVersion": kernelVersion,
|
||||
"Experimental": fmt.Sprintf("%t", daemon.configStore.Experimental),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// Populate deprecated fields for older clients
|
||||
Version: dockerversion.Version,
|
||||
GitCommit: dockerversion.GitCommit,
|
||||
APIVersion: api.DefaultVersion,
|
||||
MinAPIVersion: api.MinVersion,
|
||||
GoVersion: runtime.Version(),
|
||||
Os: runtime.GOOS,
|
||||
Arch: runtime.GOARCH,
|
||||
BuildTime: dockerversion.BuildTime,
|
||||
KernelVersion: kernelVersion,
|
||||
Experimental: daemon.configStore.Experimental,
|
||||
}
|
||||
|
||||
v.Platform.Name = dockerversion.PlatformName
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user