mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon: correctly try to retrieve init/runtime versions
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
84149ac17d
commit
858b4b44c8
2 changed files with 9 additions and 8 deletions
|
@ -59,7 +59,7 @@ func (conf *Config) GetExecRoot() string {
|
|||
return conf.ExecRoot
|
||||
}
|
||||
|
||||
// GetInitPath returns the configure docker-init path
|
||||
// GetInitPath returns the configured docker-init path
|
||||
func (conf *Config) GetInitPath() string {
|
||||
conf.Lock()
|
||||
defer conf.Unlock()
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
daemonconfig "github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/pkg/sysinfo"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -38,7 +37,8 @@ func (daemon *Daemon) FillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
|
|||
}
|
||||
|
||||
v.RuncCommit.Expected = dockerversion.RuncCommitID
|
||||
if rv, err := exec.Command(DefaultRuntimeBinary, "--version").Output(); err == nil {
|
||||
defaultRuntimeBinary := daemon.configStore.GetRuntime(daemon.configStore.GetDefaultRuntimeName()).Path
|
||||
if rv, err := exec.Command(defaultRuntimeBinary).Output(); err == nil {
|
||||
parts := strings.Split(strings.TrimSpace(string(rv)), "\n")
|
||||
if len(parts) == 3 {
|
||||
parts = strings.Split(parts[1], ": ")
|
||||
|
@ -48,23 +48,24 @@ func (daemon *Daemon) FillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
|
|||
}
|
||||
|
||||
if v.RuncCommit.ID == "" {
|
||||
logrus.Warnf("failed to retrieve %s version: unknown output format: %s", DefaultRuntimeBinary, string(rv))
|
||||
logrus.Warnf("failed to retrieve %s version: unknown output format: %s", defaultRuntimeBinary, string(rv))
|
||||
v.RuncCommit.ID = "N/A"
|
||||
}
|
||||
} else {
|
||||
logrus.Warnf("failed to retrieve %s version: %v", DefaultRuntimeBinary, err)
|
||||
logrus.Warnf("failed to retrieve %s version: %v", defaultRuntimeBinary, err)
|
||||
v.RuncCommit.ID = "N/A"
|
||||
}
|
||||
|
||||
if rv, err := exec.Command(daemonconfig.DefaultInitBinary, "--version").Output(); err == nil {
|
||||
defaultInitBinary := daemon.configStore.GetInitPath()
|
||||
if rv, err := exec.Command(defaultInitBinary, "--version").Output(); err == nil {
|
||||
ver, err := parseInitVersion(string(rv))
|
||||
|
||||
if err != nil {
|
||||
logrus.Warnf("failed to retrieve %s version: %s", daemonconfig.DefaultInitBinary, err)
|
||||
logrus.Warnf("failed to retrieve %s version: %s", defaultInitBinary, err)
|
||||
}
|
||||
v.InitCommit = ver
|
||||
} else {
|
||||
logrus.Warnf("failed to retrieve %s version: %s", daemonconfig.DefaultInitBinary, err)
|
||||
logrus.Warnf("failed to retrieve %s version: %s", defaultInitBinary, err)
|
||||
v.InitCommit.ID = "N/A"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue