Browse code

Windows: Split ContainerExecCreate

Signed-off-by: John Howard <jhoward@microsoft.com>

jhowardmsft authored on 2015/04/25 03:12:56
Showing 3 changed files
... ...
@@ -9,7 +9,6 @@ import (
9 9
 
10 10
 	"github.com/Sirupsen/logrus"
11 11
 	"github.com/docker/docker/daemon/execdriver"
12
-	"github.com/docker/docker/daemon/execdriver/lxc"
13 12
 	"github.com/docker/docker/pkg/broadcastwriter"
14 13
 	"github.com/docker/docker/pkg/ioutils"
15 14
 	"github.com/docker/docker/pkg/stringid"
... ...
@@ -111,8 +110,9 @@ func (d *Daemon) getActiveContainer(name string) (*Container, error) {
111 111
 
112 112
 func (d *Daemon) ContainerExecCreate(config *runconfig.ExecConfig) (string, error) {
113 113
 
114
-	if strings.HasPrefix(d.execDriver.Name(), lxc.DriverName) {
115
-		return "", lxc.ErrExec
114
+	// Not all drivers support Exec (LXC for example)
115
+	if err := checkExecSupport(d.execDriver.Name()); err != nil {
116
+		return "", err
116 117
 	}
117 118
 
118 119
 	container, err := d.getActiveContainer(config.Container)
119 120
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+// +build linux
1
+
2
+package daemon
3
+
4
+import (
5
+	"strings"
6
+
7
+	"github.com/docker/docker/daemon/execdriver/lxc"
8
+)
9
+
10
+// checkExecSupport returns an error if the exec driver does not support exec,
11
+// or nil if it is supported.
12
+func checkExecSupport(drivername string) error {
13
+	if strings.HasPrefix(drivername, lxc.DriverName) {
14
+		return lxc.ErrExec
15
+	}
16
+	return nil
17
+}
0 18
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+// +build windows
1
+
2
+package daemon
3
+
4
+// checkExecSupport returns an error if the exec driver does not support exec,
5
+// or nil if it is supported.
6
+func checkExecSupport(DriverName string) error {
7
+	return nil
8
+}