Skip to content

Instantly share code, notes, and snippets.

@runcom
Created July 23, 2015 22:21
Show Gist options
  • Save runcom/6332b324205d37abdad6 to your computer and use it in GitHub Desktop.
Save runcom/6332b324205d37abdad6 to your computer and use it in GitHub Desktop.
diff --git a/api/client/info.go b/api/client/info.go
index 3dba752..b508f93 100644
--- a/api/client/info.go
+++ b/api/client/info.go
@@ -46,6 +46,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
ioutils.FprintfIfNotEmpty(cli.out, "Operating System: %s\n", info.OperatingSystem)
ioutils.FprintfIfNotEmpty(cli.out, "OS: %s\n", info.OS)
ioutils.FprintfIfNotEmpty(cli.out, "Architecture: %s\n", info.Architecture)
+ ioutils.FprintfIfNotEmpty(cli.out, "OSVariant: %s\n", info.OSVariant)
fmt.Fprintf(cli.out, "CPUs: %d\n", info.NCPU)
fmt.Fprintf(cli.out, "Total Memory: %s\n", units.BytesSize(float64(info.MemTotal)))
ioutils.FprintfIfNotEmpty(cli.out, "Name: %s\n", info.Name)
diff --git a/api/server/server.go b/api/server/server.go
index 82043ca..b9c67cb 100644
--- a/api/server/server.go
+++ b/api/server/server.go
@@ -368,8 +368,7 @@ func (s *Server) getImagesJSON(version version.Version, w http.ResponseWriter, r
}
func (s *Server) getInfo(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
- osAsPrettyName := version.GreaterThanOrEqualTo("1.19")
- info, err := s.daemon.SystemInfo(osAsPrettyName)
+ info, err := s.daemon.SystemInfo(version.LessThanOrEqualTo("1.19"))
if err != nil {
return err
}
diff --git a/daemon/info.go b/daemon/info.go
index c046b7a..3ee4d13 100644
--- a/daemon/info.go
+++ b/daemon/info.go
@@ -44,11 +44,6 @@ func (daemon *Daemon) SystemInfo(includeOperatingSystem bool) (*types.Info, erro
}
}
- deprecatedOperatingSystemString := ""
- if includeOperatingSystem {
- deprecatedOperatingSystemString = prettyName
- }
-
meminfo, err := system.ReadMemInfo()
if err != nil {
logrus.Errorf("Could not read system memory info: %v", err)
@@ -78,7 +73,6 @@ func (daemon *Daemon) SystemInfo(includeOperatingSystem bool) (*types.Info, erro
LoggingDriver: daemon.defaultLogConfig.Type,
NEventsListener: daemon.EventsService.SubscribersCount(),
KernelVersion: kernelVersion,
- OperatingSystem: deprecatedOperatingSystemString,
OSVariant: prettyName,
OS: runtime.GOOS,
Architecture: runtime.GOARCH,
@@ -93,6 +87,11 @@ func (daemon *Daemon) SystemInfo(includeOperatingSystem bool) (*types.Info, erro
ExperimentalBuild: utils.ExperimentalBuild(),
}
+ // this is kept for backward compatibility
+ if includeOperatingSystem {
+ v.OperatingSystem = prettyName
+ }
+
// TODO Windows. Refactor this more once sysinfo is refactored into
// platform specific code. On Windows, sysinfo.cgroupMemInfo and
// sysinfo.cgroupCpuInfo will be nil otherwise and cause a SIGSEGV if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment