Compare commits

...

31 Commits

Author SHA1 Message Date
Nathan LeClaire
15fd4c7040 Bump version to 0.9.0
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2017-01-17 14:02:29 -08:00
Nathan LeClaire
a79b5ec50b Merge pull request #3954 from nathanleclaire/revert_docker_api_version
Revert "Add DOCKER_API_VERSION to env"
2017-01-17 13:58:35 -08:00
Nathan LeClaire
3f20d202a2 Revert "Add DOCKER_API_VERSION to env"
This reverts commit cc6c432ad8.

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2017-01-17 13:47:23 -08:00
Nathan LeClaire
c7145a096d Merge pull request #3948 from YuPengZTE/devDocs
delete the link and the sentence since the docs have been moved
2017-01-09 15:01:34 -08:00
yupengzte
22f1a633d0 delete the link and the sentence since the docs have been moved
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-01-07 19:06:53 +08:00
Nathan LeClaire
6f13031582 Merge pull request #3944 from YuPengZTE/devPng
delete png show since /docs/img has been deleted
2017-01-06 11:41:16 -08:00
yupengzte
ffaf5c55be delete png show since delete /docs/img
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-01-05 16:21:07 +08:00
Nathan LeClaire
2d0127535e Merge pull request #3942 from andrestc/ec2-check-additional-port
drivers/amazonec2: check if port is already opened in sg
2017-01-03 12:16:12 -08:00
Nathan LeClaire
eb60fac07c Merge pull request #3940 from nathanleclaire/linux_install_cmd
Revise Linux install command
2017-01-03 12:15:09 -08:00
Nathan LeClaire
3e8abdd356 Merge pull request #3934 from twang2218/add-checksum-side-file
Add checksum file of released binaries
2017-01-03 12:14:53 -08:00
Nathan LeClaire
7975180497 Revise Linux install command
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2017-01-03 11:57:00 -08:00
André Carvalho
c660f9d3d5 drivers/amazonec2: check if port is already opened in sg
Signed-off-by: André Carvalho <asantostc@gmail.com>
2017-01-03 16:46:02 -02:00
Tao Wang
fafa0e0a4f Add checksum files of released binaries
Add `sha256sum.txt` and `md5sum.txt` for release binaries.
Also fixed a minor bug which `bin/docker-machine binary` shouldn't be
shown in the released file list.

Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-12-31 02:14:50 +11:00
Nathan LeClaire
59a1877426 Merge pull request #3926 from mrburrito/exclude-docker-from-yum-update
Disable update of existing docker installation on RedHat and its derivatives.
2016-12-15 13:24:00 -08:00
Gordon Shankman
a7cdecf69c Added exclusion of docker-* packages during yum update in RedHat provisioning. This avoids accidental upgrade of docker when it is already installed.
Signed-off-by: Gordon Shankman <gshankman@gmail.com>
2016-12-15 15:42:48 -05:00
Nathan LeClaire
4e3dd8ff81 Merge pull request #3918 from shaynewang/master
Added canada-central-1 AMI image
2016-12-13 15:32:33 -08:00
Shayne Wang
8ce6b6e799 Added canada-central-1 AMI image
AMI source: 099720109477/ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20161013

Signed-off-by: Shayne Wang <shaynexwang@gmail.com>
2016-12-12 10:35:55 -08:00
Nathan LeClaire
735741f76f Merge pull request #3911 from nathanleclaire/bump_go_1.7.4
Bump Go version to 1.7.4
2016-12-08 17:56:44 -08:00
Nathan LeClaire
0871c925b0 Bump Go version to 1.7.4
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2016-12-08 14:33:19 -08:00
Nathan LeClaire
57aeabb11a Merge pull request #3910 from nathanleclaire/fix_config_cert_path
Fix 'docker-machine config' cert paths
2016-12-07 14:52:21 -08:00
Nathan LeClaire
7118884f78 Merge pull request #3891 from andrestc/apt-get-lock
libmachine/provision: wait for apt-get update lock
2016-12-07 14:22:27 -08:00
Nathan LeClaire
d8884192a2 Fix 'docker-machine config' cert paths
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2016-12-07 14:19:20 -08:00
Nathan LeClaire
bf08cd61ad Merge pull request #3888 from twang2218/update-google-ubuntu
Update GCE and Rackspace default image to Ubuntu 16.04
2016-12-02 13:42:35 -08:00
Tao Wang
c0e800cca1 Update GCE and Rackspace default image to Ubuntu 16.04
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-12-02 15:30:11 +11:00
Nathan LeClaire
8c97379cf0 Merge pull request #3889 from twang2218/cleanup-google-driver
Remove unused upstart commands left in GCE driver.
2016-12-01 16:17:30 -08:00
Nathan LeClaire
01c8c419e1 Merge pull request #3890 from twang2218/rackspace-add-env-and-default-region
Add several EnvVars and a default region for Rackspace driver
2016-12-01 16:16:38 -08:00
André Carvalho
636d7988c0 provision/utils: minor refactoring
Signed-off-by: André Carvalho <asantostc@gmail.com>
2016-11-26 12:26:49 -02:00
André Carvalho
122f761911 provision: properly handle apt-get lock error
Signed-off-by: André Carvalho <asantostc@gmail.com>
2016-11-26 12:11:56 -02:00
André Carvalho
38b4df4183 libmachine/provision: wait for apt-get update lock
Signed-off-by: André Carvalho <asantostc@gmail.com>
2016-11-25 15:30:00 -02:00
Tao Wang
f5e9381d43 Add several EnvVars and a default region for Rackspace driver
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-25 04:40:01 +11:00
Tao Wang
16a41453b6 Remove unused upstart commands left in GCE driver.
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-25 04:35:17 +11:00
21 changed files with 225 additions and 213 deletions

View File

@@ -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:
![](/docs/img/coverage.png)
## 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.

View File

@@ -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 \

View File

@@ -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
}

View File

@@ -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 {

View File

@@ -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"
)

View File

@@ -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)

View File

@@ -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"}

View File

@@ -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"},

View File

@@ -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.

View File

@@ -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

View File

@@ -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" {

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}
}

View File

@@ -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
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}

View File

@@ -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"

View File

@@ -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 && \

View File

@@ -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"