Merge pull request #2954 from jeanlaurent/engine-url
Fix #2029 - local drivers dont run with engine-install-url
This commit is contained in:
@@ -6,8 +6,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultSSHUser = "root"
|
||||
DefaultSSHPort = 22
|
||||
DefaultSSHUser = "root"
|
||||
DefaultSSHPort = 22
|
||||
DefaultEngineInstallURL = "https://get.docker.com"
|
||||
)
|
||||
|
||||
// BaseDriver - Embed this struct into drivers to provide the common set
|
||||
@@ -83,3 +84,8 @@ func (d *BaseDriver) SetSwarmConfigFromFlags(flags DriverOptions) {
|
||||
d.SwarmHost = flags.String("swarm-host")
|
||||
d.SwarmDiscovery = flags.String("swarm-discovery")
|
||||
}
|
||||
|
||||
func EngineInstallURLFlagSet(flags DriverOptions) bool {
|
||||
engineInstallURLFlag := flags.String("engine-install-url")
|
||||
return engineInstallURLFlag != DefaultEngineInstallURL && engineInstallURLFlag != ""
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/machine/libmachine/mcnflag"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -26,3 +27,24 @@ func TestIP(t *testing.T) {
|
||||
assert.Equal(t, c.expectedErr, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngineInstallUrlFlagEmpty(t *testing.T) {
|
||||
assert.False(t, EngineInstallURLFlagSet(&CheckDriverOptions{}))
|
||||
}
|
||||
|
||||
func createDriverOptionWithEngineInstall(url string) *CheckDriverOptions {
|
||||
return &CheckDriverOptions{
|
||||
FlagsValues: map[string]interface{}{"engine-install-url": url},
|
||||
CreateFlags: []mcnflag.Flag{mcnflag.StringFlag{Name: "engine-install-url", Value: ""}},
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngineInstallUrlFlagDefault(t *testing.T) {
|
||||
options := createDriverOptionWithEngineInstall(DefaultEngineInstallURL)
|
||||
assert.False(t, EngineInstallURLFlagSet(options))
|
||||
}
|
||||
|
||||
func TestEngineInstallUrlFlagSet(t *testing.T) {
|
||||
options := createDriverOptionWithEngineInstall("https://test.docker.com")
|
||||
assert.True(t, EngineInstallURLFlagSet(options))
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ func (api *Client) NewHost(driverName string, rawDriver []byte) (*host.Host, err
|
||||
ServerKeyPath: filepath.Join(api.GetMachinesDir(), "server-key.pem"),
|
||||
},
|
||||
EngineOptions: &engine.Options{
|
||||
InstallURL: "https://get.docker.com",
|
||||
InstallURL: drivers.DefaultEngineInstallURL,
|
||||
StorageDriver: "aufs",
|
||||
TLSVerify: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user