handle kernel version error in version api

Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
allencloud 2016-03-18 00:31:50 +08:00
parent 04c7d94c71
commit 73046cb8d8

View file

@ -141,9 +141,13 @@ func (daemon *Daemon) SystemVersion() types.Version {
Experimental: utils.ExperimentalBuild(),
}
if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
v.KernelVersion = kernelVersion.String()
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
return v
}