1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #37472 from thaJeztah/no_unknown

Do not return "<unknown>" in /info response
This commit is contained in:
Sebastiaan van Stijn 2018-08-16 14:56:31 +02:00 committed by GitHub
commit 0a4f89566a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -60,6 +60,14 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht
old.SecurityOptions = nameOnlySecurityOptions old.SecurityOptions = nameOnlySecurityOptions
return httputils.WriteJSON(w, http.StatusOK, old) return httputils.WriteJSON(w, http.StatusOK, old)
} }
if versions.LessThan(httputils.VersionFromContext(ctx), "1.39") {
if info.KernelVersion == "" {
info.KernelVersion = "<unknown>"
}
if info.OperatingSystem == "" {
info.OperatingSystem = "<unknown>"
}
}
return httputils.WriteJSON(w, http.StatusOK, info) return httputils.WriteJSON(w, http.StatusOK, info)
} }

View file

@ -179,7 +179,7 @@ func hostName() string {
} }
func kernelVersion() string { func kernelVersion() string {
kernelVersion := "<unknown>" var kernelVersion string
if kv, err := kernel.GetKernelVersion(); err != nil { if kv, err := kernel.GetKernelVersion(); err != nil {
logrus.Warnf("Could not get kernel version: %v", err) logrus.Warnf("Could not get kernel version: %v", err)
} else { } else {
@ -198,7 +198,7 @@ func memInfo() *system.MemInfo {
} }
func operatingSystem() string { func operatingSystem() string {
operatingSystem := "<unknown>" var operatingSystem string
if s, err := operatingsystem.GetOperatingSystem(); err != nil { if s, err := operatingsystem.GetOperatingSystem(); err != nil {
logrus.Warnf("Could not get operating system name: %v", err) logrus.Warnf("Could not get operating system name: %v", err)
} else { } else {

View file

@ -13,6 +13,13 @@ keywords: "API, Docker, rcli, REST, documentation"
will be rejected. 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 `<unknown>` for `KernelVersion`
and `OperatingSystem` if the daemon was unable to obtain this information.
## V1.38 API changes ## V1.38 API changes
[Docker Engine API v1.38](https://docs.docker.com/engine/api/v1.38/) documentation [Docker Engine API v1.38](https://docs.docker.com/engine/api/v1.38/) documentation