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:
parent
31e08fdc96
commit
f30f823bf5
1 changed files with 14 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue