mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
handle kernel and os info error in /info api
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
9ad946eded
commit
b0fb0f1993
1 changed files with 6 additions and 2 deletions
|
@ -26,12 +26,16 @@ import (
|
|||
// SystemInfo returns information about the host server the daemon is running on.
|
||||
func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
||||
kernelVersion := "<unknown>"
|
||||
if kv, err := kernel.GetKernelVersion(); err == nil {
|
||||
if kv, err := kernel.GetKernelVersion(); err != nil {
|
||||
logrus.Warnf("Could not get kernel version: %v", err)
|
||||
} else {
|
||||
kernelVersion = kv.String()
|
||||
}
|
||||
|
||||
operatingSystem := "<unknown>"
|
||||
if s, err := operatingsystem.GetOperatingSystem(); err == nil {
|
||||
if s, err := operatingsystem.GetOperatingSystem(); err != nil {
|
||||
logrus.Warnf("Could not get operating system name: %v", err)
|
||||
} else {
|
||||
operatingSystem = s
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue