Merge pull request #12978 from Microsoft/10662-containerexeccreate

Windows: Split ContainerExecCreate
This commit is contained in:
Michael Crosby 2015-05-08 11:38:03 -07:00
commit 3697dddc0d
3 changed files with 30 additions and 3 deletions

View File

@ -9,7 +9,6 @@ import (
"github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/lxc"
"github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringid"
@ -111,8 +110,9 @@ func (d *Daemon) getActiveContainer(name string) (*Container, error) {
func (d *Daemon) ContainerExecCreate(config *runconfig.ExecConfig) (string, error) {
if strings.HasPrefix(d.execDriver.Name(), lxc.DriverName) {
return "", lxc.ErrExec
// Not all drivers support Exec (LXC for example)
if err := checkExecSupport(d.execDriver.Name()); err != nil {
return "", err
}
container, err := d.getActiveContainer(config.Container)

18
daemon/exec_linux.go Normal file
View File

@ -0,0 +1,18 @@
// +build linux
package daemon
import (
"strings"
"github.com/docker/docker/daemon/execdriver/lxc"
)
// checkExecSupport returns an error if the exec driver does not support exec,
// or nil if it is supported.
func checkExecSupport(drivername string) error {
if strings.HasPrefix(drivername, lxc.DriverName) {
return lxc.ErrExec
}
return nil
}

9
daemon/exec_windows.go Normal file
View File

@ -0,0 +1,9 @@
// +build windows
package daemon
// checkExecSupport returns an error if the exec driver does not support exec,
// or nil if it is supported.
func checkExecSupport(DriverName string) error {
return nil
}