Compare commits
31 Commits
v0.9.0-rc2
...
v0.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15fd4c7040 | ||
|
|
a79b5ec50b | ||
|
|
3f20d202a2 | ||
|
|
c7145a096d | ||
|
|
22f1a633d0 | ||
|
|
6f13031582 | ||
|
|
ffaf5c55be | ||
|
|
2d0127535e | ||
|
|
eb60fac07c | ||
|
|
3e8abdd356 | ||
|
|
7975180497 | ||
|
|
c660f9d3d5 | ||
|
|
fafa0e0a4f | ||
|
|
59a1877426 | ||
|
|
a7cdecf69c | ||
|
|
4e3dd8ff81 | ||
|
|
8ce6b6e799 | ||
|
|
735741f76f | ||
|
|
0871c925b0 | ||
|
|
57aeabb11a | ||
|
|
7118884f78 | ||
|
|
d8884192a2 | ||
|
|
bf08cd61ad | ||
|
|
c0e800cca1 | ||
|
|
8c97379cf0 | ||
|
|
01c8c419e1 | ||
|
|
636d7988c0 | ||
|
|
122f761911 | ||
|
|
38b4df4183 | ||
|
|
f5e9381d43 | ||
|
|
16a41453b6 |
@@ -93,9 +93,6 @@ Alternatively, if you are building natively, you can simply run:
|
||||
|
||||
make coverage-html
|
||||
|
||||
This will generate and open the report file:
|
||||
|
||||

|
||||
|
||||
## List of all targets
|
||||
|
||||
@@ -279,10 +276,6 @@ to ensure we keep the driver in a consistent and stable state:
|
||||
and integration tests on the new supported environment
|
||||
- Participate in a weekly driver maintainer meeting
|
||||
|
||||
If you can commit to those, the next step is to make sure the driver adheres
|
||||
to the [spec](https://github.com/docker/machine/blob/master/docs/DRIVER_SPEC.md).
|
||||
|
||||
Once you have created and tested the driver, you can open a PR.
|
||||
|
||||
Note: even if those are met does not guarantee a driver will be accepted.
|
||||
If you have questions, please do not hesitate to contact us on IRC.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.7.3
|
||||
FROM golang:1.7.4
|
||||
|
||||
RUN go get github.com/golang/lint/golint \
|
||||
github.com/mattn/goveralls \
|
||||
|
||||
@@ -3,7 +3,9 @@ package commands
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/machine/commands/mcndirs"
|
||||
"github.com/docker/machine/libmachine"
|
||||
"github.com/docker/machine/libmachine/check"
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
@@ -24,15 +26,21 @@ func cmdConfig(c CommandLine, api libmachine.API) error {
|
||||
return err
|
||||
}
|
||||
|
||||
dockerHost, authOptions, err := check.DefaultConnChecker.Check(host, c.Bool("swarm"))
|
||||
dockerHost, _, err := check.DefaultConnChecker.Check(host, c.Bool("swarm"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error running connection boilerplate: %s", err)
|
||||
}
|
||||
|
||||
log.Debug(dockerHost)
|
||||
|
||||
tlsCACert := filepath.Join(mcndirs.GetMachineDir(), host.Name, "ca.pem")
|
||||
tlsCert := filepath.Join(mcndirs.GetMachineDir(), host.Name, "cert.pem")
|
||||
tlsKey := filepath.Join(mcndirs.GetMachineDir(), host.Name, "key.pem")
|
||||
|
||||
// TODO(nathanleclaire): These magic strings for the certificate file
|
||||
// names should be cross-package constants.
|
||||
fmt.Printf("--tlsverify\n--tlscacert=%q\n--tlscert=%q\n--tlskey=%q\n-H=%s\n",
|
||||
authOptions.CaCertPath, authOptions.ClientCertPath, authOptions.ClientKeyPath, dockerHost)
|
||||
tlsCACert, tlsCert, tlsKey, dockerHost)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -13,12 +13,11 @@ import (
|
||||
"github.com/docker/machine/libmachine"
|
||||
"github.com/docker/machine/libmachine/check"
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
"github.com/docker/machine/libmachine/mcndockerclient"
|
||||
"github.com/docker/machine/libmachine/shell"
|
||||
)
|
||||
|
||||
const (
|
||||
envTmpl = `{{ .Prefix }}DOCKER_TLS_VERIFY{{ .Delimiter }}{{ .DockerTLSVerify }}{{ .Suffix }}{{ .Prefix }}DOCKER_HOST{{ .Delimiter }}{{ .DockerHost }}{{ .Suffix }}{{ .Prefix }}DOCKER_CERT_PATH{{ .Delimiter }}{{ .DockerCertPath }}{{ .Suffix }}{{ .Prefix }}DOCKER_MACHINE_NAME{{ .Delimiter }}{{ .MachineName }}{{ .Suffix }}{{ .Prefix }}DOCKER_API_VERSION{{ .Delimiter }}{{ .DockerAPIVersion }}{{ .Suffix }}{{ if .ComposePathsVar }}{{ .Prefix }}COMPOSE_CONVERT_WINDOWS_PATHS{{ .Delimiter }}true{{ .Suffix }}{{end}}{{ if .NoProxyVar }}{{ .Prefix }}{{ .NoProxyVar }}{{ .Delimiter }}{{ .NoProxyValue }}{{ .Suffix }}{{end}}{{ .UsageHint }}`
|
||||
envTmpl = `{{ .Prefix }}DOCKER_TLS_VERIFY{{ .Delimiter }}{{ .DockerTLSVerify }}{{ .Suffix }}{{ .Prefix }}DOCKER_HOST{{ .Delimiter }}{{ .DockerHost }}{{ .Suffix }}{{ .Prefix }}DOCKER_CERT_PATH{{ .Delimiter }}{{ .DockerCertPath }}{{ .Suffix }}{{ .Prefix }}DOCKER_MACHINE_NAME{{ .Delimiter }}{{ .MachineName }}{{ .Suffix }}{{ if .ComposePathsVar }}{{ .Prefix }}COMPOSE_CONVERT_WINDOWS_PATHS{{ .Delimiter }}true{{ .Suffix }}{{end}}{{ if .NoProxyVar }}{{ .Prefix }}{{ .NoProxyVar }}{{ .Delimiter }}{{ .NoProxyValue }}{{ .Suffix }}{{end}}{{ .UsageHint }}`
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -32,18 +31,17 @@ func init() {
|
||||
}
|
||||
|
||||
type ShellConfig struct {
|
||||
Prefix string
|
||||
Delimiter string
|
||||
Suffix string
|
||||
DockerCertPath string
|
||||
DockerHost string
|
||||
DockerTLSVerify string
|
||||
DockerAPIVersion string
|
||||
UsageHint string
|
||||
MachineName string
|
||||
NoProxyVar string
|
||||
NoProxyValue string
|
||||
ComposePathsVar bool
|
||||
Prefix string
|
||||
Delimiter string
|
||||
Suffix string
|
||||
DockerCertPath string
|
||||
DockerHost string
|
||||
DockerTLSVerify string
|
||||
UsageHint string
|
||||
MachineName string
|
||||
NoProxyVar string
|
||||
NoProxyValue string
|
||||
ComposePathsVar bool
|
||||
}
|
||||
|
||||
func cmdEnv(c CommandLine, api libmachine.API) error {
|
||||
@@ -104,16 +102,6 @@ func shellCfgSet(c CommandLine, api libmachine.API) (*ShellConfig, error) {
|
||||
MachineName: host.Name,
|
||||
}
|
||||
|
||||
remoteDocker := &mcndockerclient.RemoteDocker{
|
||||
HostURL: dockerHost,
|
||||
AuthOption: host.AuthOptions(),
|
||||
}
|
||||
dockerAPIVersion, err := mcndockerclient.DockerAPIVersion(remoteDocker)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
shellCfg.DockerAPIVersion = dockerAPIVersion
|
||||
|
||||
if c.Bool("no-proxy") {
|
||||
ip, err := host.Driver.GetIP()
|
||||
if err != nil {
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/docker/machine/libmachine/check"
|
||||
"github.com/docker/machine/libmachine/host"
|
||||
"github.com/docker/machine/libmachine/libmachinetest"
|
||||
"github.com/docker/machine/libmachine/mcndockerclient"
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -97,7 +96,6 @@ func revertUsageHinter(uhg UsageHintGenerator) {
|
||||
}
|
||||
|
||||
func TestShellCfgSet(t *testing.T) {
|
||||
mcndockerclient.CurrentDockerVersioner = &mcndockerclient.FakeDockerVersioner{APIVersion: "1.21"}
|
||||
const (
|
||||
usageHint = "This is a usage hint"
|
||||
)
|
||||
@@ -154,16 +152,15 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
expectedErr: nil,
|
||||
},
|
||||
@@ -192,16 +189,15 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), defaultMachineName),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
MachineName: defaultMachineName,
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), defaultMachineName),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
MachineName: defaultMachineName,
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
expectedErr: nil,
|
||||
},
|
||||
@@ -230,16 +226,15 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "set -gx ",
|
||||
Suffix: "\";\n",
|
||||
Delimiter: " \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "set -gx ",
|
||||
Suffix: "\";\n",
|
||||
Delimiter: " \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
expectedErr: nil,
|
||||
},
|
||||
@@ -268,16 +263,15 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "$Env:",
|
||||
Suffix: "\"\n",
|
||||
Delimiter: " = \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "$Env:",
|
||||
Suffix: "\"\n",
|
||||
Delimiter: " = \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
expectedErr: nil,
|
||||
},
|
||||
@@ -306,16 +300,15 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "(setenv \"",
|
||||
Suffix: "\")\n",
|
||||
Delimiter: "\" \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "(setenv \"",
|
||||
Suffix: "\")\n",
|
||||
Delimiter: "\" \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
expectedErr: nil,
|
||||
},
|
||||
@@ -344,16 +337,15 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "SET ",
|
||||
Suffix: "\n",
|
||||
Delimiter: "=",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "SET ",
|
||||
Suffix: "\n",
|
||||
Delimiter: "=",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
expectedErr: nil,
|
||||
},
|
||||
@@ -386,18 +378,17 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
NoProxyVar: "NO_PROXY",
|
||||
NoProxyValue: "1.2.3.4", // From FakeDriver
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
NoProxyVar: "NO_PROXY",
|
||||
NoProxyValue: "1.2.3.4", // From FakeDriver
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
noProxyVar: "NO_PROXY",
|
||||
noProxyValue: "",
|
||||
@@ -432,18 +423,17 @@ func TestShellCfgSet(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
NoProxyVar: "no_proxy",
|
||||
NoProxyValue: "192.168.59.1,1.2.3.4", // From FakeDriver
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
Prefix: "export ",
|
||||
Delimiter: "=\"",
|
||||
Suffix: "\"\n",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
NoProxyVar: "no_proxy",
|
||||
NoProxyValue: "192.168.59.1,1.2.3.4", // From FakeDriver
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: isRuntimeWindows,
|
||||
},
|
||||
noProxyVar: "no_proxy",
|
||||
noProxyValue: "192.168.59.1",
|
||||
@@ -468,7 +458,6 @@ func TestShellCfgSet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShellCfgSetWindowsRuntime(t *testing.T) {
|
||||
mcndockerclient.CurrentDockerVersioner = &mcndockerclient.FakeDockerVersioner{APIVersion: "1.21"}
|
||||
const (
|
||||
usageHint = "This is a usage hint"
|
||||
)
|
||||
@@ -513,16 +502,15 @@ func TestShellCfgSetWindowsRuntime(t *testing.T) {
|
||||
Err: nil,
|
||||
},
|
||||
expectedShellCfg: &ShellConfig{
|
||||
Prefix: "$Env:",
|
||||
Suffix: "\"\n",
|
||||
Delimiter: " = \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
DockerAPIVersion: "1.21",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: true,
|
||||
Prefix: "$Env:",
|
||||
Suffix: "\"\n",
|
||||
Delimiter: " = \"",
|
||||
DockerCertPath: filepath.Join(mcndirs.GetMachineDir(), "quux"),
|
||||
DockerHost: "tcp://1.2.3.4:2376",
|
||||
DockerTLSVerify: "1",
|
||||
UsageHint: usageHint,
|
||||
MachineName: "quux",
|
||||
ComposePathsVar: true,
|
||||
},
|
||||
expectedErr: nil,
|
||||
},
|
||||
@@ -549,7 +537,6 @@ func TestShellCfgSetWindowsRuntime(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShellCfgUnset(t *testing.T) {
|
||||
mcndockerclient.CurrentDockerVersioner = &mcndockerclient.FakeDockerVersioner{APIVersion: "1.21"}
|
||||
const (
|
||||
usageHint = "This is the unset usage hint"
|
||||
)
|
||||
|
||||
@@ -1086,25 +1086,16 @@ func (d *Driver) configureSecurityGroups(groupNames []string) error {
|
||||
}
|
||||
|
||||
func (d *Driver) configureSecurityGroupPermissions(group *ec2.SecurityGroup) ([]*ec2.IpPermission, error) {
|
||||
hasSshPort := false
|
||||
hasDockerPort := false
|
||||
hasSwarmPort := false
|
||||
hasPorts := make(map[string]bool)
|
||||
for _, p := range group.IpPermissions {
|
||||
if p.FromPort != nil {
|
||||
switch *p.FromPort {
|
||||
case 22:
|
||||
hasSshPort = true
|
||||
case int64(dockerPort):
|
||||
hasDockerPort = true
|
||||
case int64(swarmPort):
|
||||
hasSwarmPort = true
|
||||
}
|
||||
hasPorts[fmt.Sprintf("%d/%s", *p.FromPort, *p.IpProtocol)] = true
|
||||
}
|
||||
}
|
||||
|
||||
perms := []*ec2.IpPermission{}
|
||||
|
||||
if !hasSshPort {
|
||||
if !hasPorts["22/tcp"] {
|
||||
perms = append(perms, &ec2.IpPermission{
|
||||
IpProtocol: aws.String("tcp"),
|
||||
FromPort: aws.Int64(22),
|
||||
@@ -1113,7 +1104,7 @@ func (d *Driver) configureSecurityGroupPermissions(group *ec2.SecurityGroup) ([]
|
||||
})
|
||||
}
|
||||
|
||||
if !hasDockerPort {
|
||||
if !hasPorts[fmt.Sprintf("%d/tcp", dockerPort)] {
|
||||
perms = append(perms, &ec2.IpPermission{
|
||||
IpProtocol: aws.String("tcp"),
|
||||
FromPort: aws.Int64(int64(dockerPort)),
|
||||
@@ -1122,7 +1113,7 @@ func (d *Driver) configureSecurityGroupPermissions(group *ec2.SecurityGroup) ([]
|
||||
})
|
||||
}
|
||||
|
||||
if !hasSwarmPort && d.SwarmMaster {
|
||||
if !hasPorts[fmt.Sprintf("%d/tcp", swarmPort)] && d.SwarmMaster {
|
||||
perms = append(perms, &ec2.IpPermission{
|
||||
IpProtocol: aws.String("tcp"),
|
||||
FromPort: aws.Int64(int64(swarmPort)),
|
||||
@@ -1137,12 +1128,14 @@ func (d *Driver) configureSecurityGroupPermissions(group *ec2.SecurityGroup) ([]
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid port number %s: %s", port, err)
|
||||
}
|
||||
perms = append(perms, &ec2.IpPermission{
|
||||
IpProtocol: aws.String(protocol),
|
||||
FromPort: aws.Int64(portNum),
|
||||
ToPort: aws.Int64(portNum),
|
||||
IpRanges: []*ec2.IpRange{{CidrIp: aws.String(ipRange)}},
|
||||
})
|
||||
if !hasPorts[fmt.Sprintf("%s/%s", port, protocol)] {
|
||||
perms = append(perms, &ec2.IpPermission{
|
||||
IpProtocol: aws.String(protocol),
|
||||
FromPort: aws.Int64(portNum),
|
||||
ToPort: aws.Int64(portNum),
|
||||
IpRanges: []*ec2.IpRange{{CidrIp: aws.String(ipRange)}},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("configuring security group authorization for %s", ipRange)
|
||||
|
||||
@@ -6,14 +6,15 @@ import (
|
||||
"errors"
|
||||
"reflect"
|
||||
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/docker/machine/commands/commandstest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -112,6 +113,29 @@ func TestConfigureSecurityGroupPermissionsOpenPorts(t *testing.T) {
|
||||
assert.Equal(t, aws.String("tcp"), perms[4].IpProtocol)
|
||||
}
|
||||
|
||||
func TestConfigureSecurityGroupPermissionsOpenPortsSkipExisting(t *testing.T) {
|
||||
driver := NewTestDriver()
|
||||
group := securityGroup
|
||||
group.IpPermissions = []*ec2.IpPermission{
|
||||
{
|
||||
IpProtocol: aws.String("tcp"),
|
||||
FromPort: aws.Int64(8888),
|
||||
ToPort: aws.Int64(testSSHPort),
|
||||
},
|
||||
{
|
||||
IpProtocol: aws.String("tcp"),
|
||||
FromPort: aws.Int64(8080),
|
||||
ToPort: aws.Int64(testSSHPort),
|
||||
},
|
||||
}
|
||||
driver.OpenPorts = []string{"8888/tcp", "8080/udp", "8080"}
|
||||
perms, err := driver.configureSecurityGroupPermissions(group)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, perms, 3)
|
||||
assert.Equal(t, aws.Int64(int64(8080)), perms[2].ToPort)
|
||||
assert.Equal(t, aws.String("udp"), perms[2].IpProtocol)
|
||||
}
|
||||
|
||||
func TestConfigureSecurityGroupPermissionsInvalidOpenPorts(t *testing.T) {
|
||||
driver := NewTestDriver()
|
||||
driver.OpenPorts = []string{"2222/tcp", "abc1"}
|
||||
|
||||
@@ -16,6 +16,7 @@ var regionDetails map[string]*region = map[string]*region{
|
||||
"ap-southeast-1": {"ami-18e7417b"},
|
||||
"ap-southeast-2": {"ami-7be4d618"},
|
||||
"ap-south-1": {"ami-7e94fe11"},
|
||||
"ca-central-1": {"ami-ca6ddfae"},
|
||||
"cn-north-1": {"ami-d7c511ba"},
|
||||
"eu-central-1": {"ami-597c8236"},
|
||||
"eu-west-1": {"ami-c593deb6"},
|
||||
|
||||
@@ -38,12 +38,10 @@ type ComputeUtil struct {
|
||||
}
|
||||
|
||||
const (
|
||||
apiURL = "https://www.googleapis.com/compute/v1/projects/"
|
||||
firewallRule = "docker-machines"
|
||||
port = "2376"
|
||||
firewallTargetTag = "docker-machine"
|
||||
dockerStartCommand = "sudo service docker start"
|
||||
dockerStopCommand = "sudo service docker stop"
|
||||
apiURL = "https://www.googleapis.com/compute/v1/projects/"
|
||||
firewallRule = "docker-machines"
|
||||
port = "2376"
|
||||
firewallTargetTag = "docker-machine"
|
||||
)
|
||||
|
||||
// NewComputeUtil creates and initializes a ComputeUtil.
|
||||
|
||||
@@ -36,7 +36,7 @@ const (
|
||||
defaultZone = "us-central1-a"
|
||||
defaultUser = "docker-user"
|
||||
defaultMachineType = "n1-standard-1"
|
||||
defaultImageName = "ubuntu-os-cloud/global/images/ubuntu-1510-wily-v20160627"
|
||||
defaultImageName = "ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20161130"
|
||||
defaultScopes = "https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write"
|
||||
defaultDiskType = "pd-standard"
|
||||
defaultDiskSize = 10
|
||||
|
||||
@@ -17,6 +17,7 @@ type Driver struct {
|
||||
}
|
||||
|
||||
const (
|
||||
defaultRegionName = "IAD"
|
||||
defaultEndpointType = "publicURL"
|
||||
defaultFlavorID = "general1-1"
|
||||
defaultSSHUser = "root"
|
||||
@@ -45,7 +46,7 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
|
||||
EnvVar: "OS_REGION_NAME",
|
||||
Name: "rackspace-region",
|
||||
Usage: "Rackspace region name",
|
||||
Value: "",
|
||||
Value: defaultRegionName,
|
||||
},
|
||||
mcnflag.StringFlag{
|
||||
EnvVar: "OS_ENDPOINT_TYPE",
|
||||
@@ -54,24 +55,27 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
|
||||
Value: defaultEndpointType,
|
||||
},
|
||||
mcnflag.StringFlag{
|
||||
Name: "rackspace-image-id",
|
||||
Usage: "Rackspace image ID. Default: Ubuntu 15.10 (Wily Werewolf) (PVHVM)",
|
||||
EnvVar: "OS_IMAGE_ID",
|
||||
Name: "rackspace-image-id",
|
||||
Usage: "Rackspace image ID. Default: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)",
|
||||
},
|
||||
mcnflag.StringFlag{
|
||||
EnvVar: "OS_FLAVOR_ID",
|
||||
Name: "rackspace-flavor-id",
|
||||
Usage: "Rackspace flavor ID. Default: General Purpose 1GB",
|
||||
Value: defaultFlavorID,
|
||||
EnvVar: "OS_FLAVOR_ID",
|
||||
},
|
||||
mcnflag.StringFlag{
|
||||
Name: "rackspace-ssh-user",
|
||||
Usage: "SSH user for the newly booted machine. Set to root by default",
|
||||
Value: defaultSSHUser,
|
||||
EnvVar: "OS_SSH_USER",
|
||||
Name: "rackspace-ssh-user",
|
||||
Usage: "SSH user for the newly booted machine. Set to root by default",
|
||||
Value: defaultSSHUser,
|
||||
},
|
||||
mcnflag.IntFlag{
|
||||
Name: "rackspace-ssh-port",
|
||||
Usage: "SSH port for the newly booted machine. Set to 22 by default",
|
||||
Value: defaultSSHPort,
|
||||
EnvVar: "OS_SSH_PORT",
|
||||
Name: "rackspace-ssh-port",
|
||||
Usage: "SSH port for the newly booted machine. Set to 22 by default",
|
||||
Value: defaultSSHPort,
|
||||
},
|
||||
mcnflag.StringFlag{
|
||||
Name: "rackspace-docker-install",
|
||||
@@ -140,10 +144,10 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||
}
|
||||
|
||||
if d.ImageId == "" {
|
||||
// Default to the Ubuntu 15.10 image.
|
||||
// Default to the Ubuntu 16.04 image.
|
||||
// This is done here, rather than in the option registration, to keep the default value
|
||||
// from making "machine create --help" ugly.
|
||||
d.ImageId = "59a3fadd-93e7-4674-886a-64883e17115f"
|
||||
d.ImageId = "821ba5f4-712d-4ec8-9c65-a3fa4bc500f9"
|
||||
}
|
||||
|
||||
if d.EndpointType != "publicURL" && d.EndpointType != "adminURL" && d.EndpointType != "internalURL" {
|
||||
|
||||
@@ -6,17 +6,12 @@ var CurrentDockerVersioner DockerVersioner = &defaultDockerVersioner{}
|
||||
|
||||
type DockerVersioner interface {
|
||||
DockerVersion(host DockerHost) (string, error)
|
||||
DockerAPIVersion(host DockerHost) (string, error)
|
||||
}
|
||||
|
||||
func DockerVersion(host DockerHost) (string, error) {
|
||||
return CurrentDockerVersioner.DockerVersion(host)
|
||||
}
|
||||
|
||||
func DockerAPIVersion(host DockerHost) (string, error) {
|
||||
return CurrentDockerVersioner.DockerAPIVersion(host)
|
||||
}
|
||||
|
||||
type defaultDockerVersioner struct{}
|
||||
|
||||
func (dv *defaultDockerVersioner) DockerVersion(host DockerHost) (string, error) {
|
||||
@@ -32,17 +27,3 @@ func (dv *defaultDockerVersioner) DockerVersion(host DockerHost) (string, error)
|
||||
|
||||
return version.Version, nil
|
||||
}
|
||||
|
||||
func (dv *defaultDockerVersioner) DockerAPIVersion(host DockerHost) (string, error) {
|
||||
client, err := DockerClient(host)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Unable to query docker API version: %s", err)
|
||||
}
|
||||
|
||||
version, err := client.Version()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Unable to query docker API version: %s", err)
|
||||
}
|
||||
|
||||
return version.ApiVersion, nil
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package mcndockerclient
|
||||
|
||||
type FakeDockerVersioner struct {
|
||||
Version string
|
||||
APIVersion string
|
||||
Err error
|
||||
Version string
|
||||
Err error
|
||||
}
|
||||
|
||||
func (dv *FakeDockerVersioner) DockerVersion(host DockerHost) (string, error) {
|
||||
@@ -13,11 +12,3 @@ func (dv *FakeDockerVersioner) DockerVersion(host DockerHost) (string, error) {
|
||||
|
||||
return dv.Version, nil
|
||||
}
|
||||
|
||||
func (dv *FakeDockerVersioner) DockerAPIVersion(host DockerHost) (string, error) {
|
||||
if dv.Err != nil {
|
||||
return "", dv.Err
|
||||
}
|
||||
|
||||
return dv.APIVersion, nil
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func (provisioner *DebianProvisioner) Package(name string, action pkgaction.Pack
|
||||
}
|
||||
|
||||
if updateMetadata {
|
||||
if _, err := provisioner.SSHCommand("sudo apt-get update"); err != nil {
|
||||
if err := waitForLockAptGetUpdate(provisioner); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ func (provisioner *RedHatProvisioner) Provision(swarmOptions swarm.Options, auth
|
||||
}
|
||||
|
||||
// update OS -- this is needed for libdevicemapper and the docker install
|
||||
if _, err := provisioner.SSHCommand("sudo -E yum -y update"); err != nil {
|
||||
if _, err := provisioner.SSHCommand("sudo -E yum -y update -x docker-*"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ func (provisioner *UbuntuSystemdProvisioner) Package(name string, action pkgacti
|
||||
}
|
||||
|
||||
if updateMetadata {
|
||||
if _, err := provisioner.SSHCommand("sudo apt-get update"); err != nil {
|
||||
if err := waitForLockAptGetUpdate(provisioner); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ func (provisioner *UbuntuProvisioner) Package(name string, action pkgaction.Pack
|
||||
}
|
||||
|
||||
if updateMetadata {
|
||||
if _, err := provisioner.SSHCommand("sudo apt-get update"); err != nil {
|
||||
if err := waitForLockAptGetUpdate(provisioner); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,3 +294,25 @@ func DockerClientVersion(ssh SSHCommander) (string, error) {
|
||||
|
||||
return strings.TrimRight(words[2], ","), nil
|
||||
}
|
||||
|
||||
func waitForLockAptGetUpdate(ssh SSHCommander) error {
|
||||
var sshErr error
|
||||
err := mcnutils.WaitFor(func() bool {
|
||||
_, sshErr = ssh.SSHCommand("sudo apt-get update")
|
||||
if sshErr != nil {
|
||||
if strings.Contains(sshErr.Error(), "Could not get lock") {
|
||||
sshErr = nil
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
return true
|
||||
})
|
||||
if sshErr != nil {
|
||||
return fmt.Errorf("Error running apt-get update: %s", sshErr)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to obtain apt-get update lock: %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -139,11 +139,14 @@ CONTRIBUTORS=$(git log "${LAST_RELEASE_VERSION}".. --format="%aN" --reverse | so
|
||||
CHANGELOG=$(git log "${LAST_RELEASE_VERSION}".. --oneline | grep -v 'Merge pull request')
|
||||
|
||||
CHECKSUM=""
|
||||
for file in $(ls bin/docker-machine*); do
|
||||
rm -f sha256sum.txt md5sum.txt
|
||||
for file in $(ls bin/docker-machine-*); do
|
||||
SHA256=$(openssl dgst -sha256 < "${file}")
|
||||
MD5=$(openssl dgst -md5 < "${file}")
|
||||
LINE=$(printf "\n * **%s**\n * sha256 \`%s\`\n * md5 \`%s\`\n\n" "$(basename ${file})" "${SHA256}" "${MD5}")
|
||||
CHECKSUM="${CHECKSUM}${LINE}"
|
||||
echo "${SHA256} ${file:4}" >> sha256sum.txt
|
||||
echo "${MD5} ${file:4}" >> md5sum.txt
|
||||
done
|
||||
|
||||
TEMPLATE=$(cat "${GITHUB_RELEASE_FILE}")
|
||||
@@ -229,6 +232,21 @@ for file in $(ls bin/docker-machine-*); do
|
||||
fi
|
||||
done
|
||||
|
||||
display "Uploading sha256sum.txt and md5sum.txt"
|
||||
for file in sha256sum.txt md5sum.txt; do
|
||||
display "Uploading ${file}..."
|
||||
github-release upload \
|
||||
--security-token "${GITHUB_TOKEN}" \
|
||||
--user "${GITHUB_USER}" \
|
||||
--repo "${GITHUB_REPO}" \
|
||||
--tag "${GITHUB_VERSION}" \
|
||||
--name "$(basename "${file}")" \
|
||||
--file "${file}"
|
||||
if [[ "$?" -ne 0 ]]; then
|
||||
display "Could not upload ${file}, continuing with others"
|
||||
fi
|
||||
done
|
||||
|
||||
git remote rm remote.prod.url
|
||||
|
||||
rm ${GITHUB_RELEASE_FILE}
|
||||
@@ -240,5 +258,3 @@ echo " 3. Update the documentation branch"
|
||||
echo " 4. Test the binaries linked from the github release page"
|
||||
echo " 5. Change version/version.go to the next dev version"
|
||||
echo " 6. Party !!"
|
||||
echo
|
||||
echo "The full details of these tasks are described in the RELEASE.md document, available at https://github.com/${GITHUB_USER}/${GITHUB_REPO}/blob/master/docs/RELEASE.md"
|
||||
|
||||
@@ -4,11 +4,17 @@ If you're a Mac or Windows user, the [Docker Toolbox](https://www.docker.com/doc
|
||||
|
||||
You can use the usual commands to install or upgrade:
|
||||
|
||||
On OS X or Linux
|
||||
On OS X
|
||||
```console
|
||||
$ curl -L https://github.com/docker/machine/releases/download/{{VERSION}}/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine && \
|
||||
chmod +x /usr/local/bin/docker-machine
|
||||
```
|
||||
On Linux
|
||||
```console
|
||||
$ curl -L https://github.com/docker/machine/releases/download/{{VERSION}}/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
|
||||
chmod +x /tmp/docker-machine &&
|
||||
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
|
||||
```
|
||||
On Windows with git bash
|
||||
```console
|
||||
$ if [[ ! -d "$HOME/bin" ]]; then mkdir -p "$HOME/bin"; fi && \
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var (
|
||||
// Version should be updated by hand at each release
|
||||
Version = "0.8.2"
|
||||
Version = "0.9.0"
|
||||
|
||||
// GitCommit will be overwritten automatically by the build system
|
||||
GitCommit = "HEAD"
|
||||
|
||||
Reference in New Issue
Block a user