1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

fix docker info with lxc 1.0.0

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
This commit is contained in:
Victor Vieux 2014-02-28 00:32:58 +00:00
parent 31e08fdc96
commit f30f823bf5

View file

@ -206,11 +206,20 @@ func (d *driver) Restore(c *execdriver.Command) error {
} }
func (d *driver) version() string { func (d *driver) version() string {
version := "" var (
if output, err := exec.Command("lxc-version").CombinedOutput(); err == nil { version string
outputStr := string(output) output []byte
if len(strings.SplitN(outputStr, ":", 2)) == 2 { err error
version = strings.TrimSpace(strings.SplitN(outputStr, ":", 2)[1]) )
if _, errPath := exec.LookPath("lxc-version"); errPath == nil {
output, err = exec.Command("lxc-version").CombinedOutput()
} else {
output, err = exec.Command("lxc-start", "--version").CombinedOutput()
}
if err == nil {
version = strings.TrimSpace(string(output))
if parts := strings.SplitN(version, ":", 2); len(parts) == 2 {
version = strings.TrimSpace(parts[1])
} }
} }
return version return version