Browse code

daemon: correctly try to retrieve init/runtime versions

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

Antonio Murdaca authored on 2017/06/07 02:36:24
Showing 2 changed files
... ...
@@ -59,7 +59,7 @@ func (conf *Config) GetExecRoot() string {
59 59
 	return conf.ExecRoot
60 60
 }
61 61
 
62
-// GetInitPath returns the configure docker-init path
62
+// GetInitPath returns the configured docker-init path
63 63
 func (conf *Config) GetInitPath() string {
64 64
 	conf.Lock()
65 65
 	defer conf.Unlock()
... ...
@@ -9,7 +9,6 @@ import (
9 9
 
10 10
 	"github.com/Sirupsen/logrus"
11 11
 	"github.com/docker/docker/api/types"
12
-	daemonconfig "github.com/docker/docker/daemon/config"
13 12
 	"github.com/docker/docker/dockerversion"
14 13
 	"github.com/docker/docker/pkg/sysinfo"
15 14
 	"github.com/pkg/errors"
... ...
@@ -38,7 +37,8 @@ func (daemon *Daemon) FillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
38 38
 	}
39 39
 
40 40
 	v.RuncCommit.Expected = dockerversion.RuncCommitID
41
-	if rv, err := exec.Command(DefaultRuntimeBinary, "--version").Output(); err == nil {
41
+	defaultRuntimeBinary := daemon.configStore.GetRuntime(daemon.configStore.GetDefaultRuntimeName()).Path
42
+	if rv, err := exec.Command(defaultRuntimeBinary).Output(); err == nil {
42 43
 		parts := strings.Split(strings.TrimSpace(string(rv)), "\n")
43 44
 		if len(parts) == 3 {
44 45
 			parts = strings.Split(parts[1], ": ")
... ...
@@ -48,23 +48,24 @@ func (daemon *Daemon) FillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
48 48
 		}
49 49
 
50 50
 		if v.RuncCommit.ID == "" {
51
-			logrus.Warnf("failed to retrieve %s version: unknown output format: %s", DefaultRuntimeBinary, string(rv))
51
+			logrus.Warnf("failed to retrieve %s version: unknown output format: %s", defaultRuntimeBinary, string(rv))
52 52
 			v.RuncCommit.ID = "N/A"
53 53
 		}
54 54
 	} else {
55
-		logrus.Warnf("failed to retrieve %s version: %v", DefaultRuntimeBinary, err)
55
+		logrus.Warnf("failed to retrieve %s version: %v", defaultRuntimeBinary, err)
56 56
 		v.RuncCommit.ID = "N/A"
57 57
 	}
58 58
 
59
-	if rv, err := exec.Command(daemonconfig.DefaultInitBinary, "--version").Output(); err == nil {
59
+	defaultInitBinary := daemon.configStore.GetInitPath()
60
+	if rv, err := exec.Command(defaultInitBinary, "--version").Output(); err == nil {
60 61
 		ver, err := parseInitVersion(string(rv))
61 62
 
62 63
 		if err != nil {
63
-			logrus.Warnf("failed to retrieve %s version: %s", daemonconfig.DefaultInitBinary, err)
64
+			logrus.Warnf("failed to retrieve %s version: %s", defaultInitBinary, err)
64 65
 		}
65 66
 		v.InitCommit = ver
66 67
 	} else {
67
-		logrus.Warnf("failed to retrieve %s version: %s", daemonconfig.DefaultInitBinary, err)
68
+		logrus.Warnf("failed to retrieve %s version: %s", defaultInitBinary, err)
68 69
 		v.InitCommit.ID = "N/A"
69 70
 	}
70 71
 }