diff --git a/api/server/router/system/system_routes.go b/api/server/router/system/system_routes.go index 82b649e98f..15c3120af5 100644 --- a/api/server/router/system/system_routes.go +++ b/api/server/router/system/system_routes.go @@ -60,6 +60,14 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht old.SecurityOptions = nameOnlySecurityOptions return httputils.WriteJSON(w, http.StatusOK, old) } + if versions.LessThan(httputils.VersionFromContext(ctx), "1.39") { + if info.KernelVersion == "" { + info.KernelVersion = "" + } + if info.OperatingSystem == "" { + info.OperatingSystem = "" + } + } return httputils.WriteJSON(w, http.StatusOK, info) } diff --git a/daemon/info.go b/daemon/info.go index 0ed81c3b5e..94dc2c237c 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -179,7 +179,7 @@ func hostName() string { } func kernelVersion() string { - kernelVersion := "" + var kernelVersion string if kv, err := kernel.GetKernelVersion(); err != nil { logrus.Warnf("Could not get kernel version: %v", err) } else { @@ -198,7 +198,7 @@ func memInfo() *system.MemInfo { } func operatingSystem() string { - operatingSystem := "" + var operatingSystem string if s, err := operatingsystem.GetOperatingSystem(); err != nil { logrus.Warnf("Could not get operating system name: %v", err) } else { diff --git a/docs/api/version-history.md b/docs/api/version-history.md index 749d9788f6..416187f292 100644 --- a/docs/api/version-history.md +++ b/docs/api/version-history.md @@ -13,6 +13,13 @@ keywords: "API, Docker, rcli, REST, documentation" will be rejected. --> +## V1.39 API changes + +[Docker Engine API v1.39](https://docs.docker.com/engine/api/v1.39/) documentation + +* `GET /info` now returns an empty string, instead of `` for `KernelVersion` + and `OperatingSystem` if the daemon was unable to obtain this information. + ## V1.38 API changes [Docker Engine API v1.38](https://docs.docker.com/engine/api/v1.38/) documentation