Skip to content

Commit

Permalink
Merge pull request moby#4376 from vieux/fix_lxc_version
Browse files Browse the repository at this point in the history
fix docker info with lxc 1.0.0
  • Loading branch information
unclejack committed Feb 28, 2014
2 parents 31e08fd + f30f823 commit b4146fb
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions execdriver/lxc/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,20 @@ func (d *driver) Restore(c *execdriver.Command) error {
}

func (d *driver) version() string {
version := ""
if output, err := exec.Command("lxc-version").CombinedOutput(); err == nil {
outputStr := string(output)
if len(strings.SplitN(outputStr, ":", 2)) == 2 {
version = strings.TrimSpace(strings.SplitN(outputStr, ":", 2)[1])
var (
version string
output []byte
err error
)
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
Expand Down

0 comments on commit b4146fb

Please sign in to comment.