mirror of https://github.com/docker/docs.git
parent
24da8ad7a8
commit
d2ada6488c
|
@ -2,4 +2,4 @@ sudo: required
|
||||||
dist: trusty
|
dist: trusty
|
||||||
language: bash
|
language: bash
|
||||||
services: docker
|
services: docker
|
||||||
script: USE_CONTAINER=true make dco fmt vet test-short test-long coverage-send
|
script: USE_CONTAINER=true make dco fmt lint vet test-short test-long coverage-send
|
||||||
|
|
|
@ -475,7 +475,7 @@ func runActionWithContext(actionName string, c CommandLine) error {
|
||||||
// codegangsta/cli will not set the cert paths if the storage-path is set to
|
// codegangsta/cli will not set the cert paths if the storage-path is set to
|
||||||
// something different so we cannot use the paths in the global options. le
|
// something different so we cannot use the paths in the global options. le
|
||||||
// sigh.
|
// sigh.
|
||||||
func getCertPathInfoFromContext(c CommandLine) cert.CertPathInfo {
|
func getCertPathInfoFromContext(c CommandLine) cert.PathInfo {
|
||||||
caCertPath := c.GlobalString("tls-ca-cert")
|
caCertPath := c.GlobalString("tls-ca-cert")
|
||||||
caKeyPath := c.GlobalString("tls-ca-key")
|
caKeyPath := c.GlobalString("tls-ca-key")
|
||||||
clientCertPath := c.GlobalString("tls-client-cert")
|
clientCertPath := c.GlobalString("tls-client-cert")
|
||||||
|
@ -497,7 +497,7 @@ func getCertPathInfoFromContext(c CommandLine) cert.CertPathInfo {
|
||||||
clientKeyPath = filepath.Join(mcndirs.GetMachineCertDir(), "key.pem")
|
clientKeyPath = filepath.Join(mcndirs.GetMachineCertDir(), "key.pem")
|
||||||
}
|
}
|
||||||
|
|
||||||
return cert.CertPathInfo{
|
return cert.PathInfo{
|
||||||
CaCertPath: caCertPath,
|
CaCertPath: caCertPath,
|
||||||
CaPrivateKeyPath: caKeyPath,
|
CaPrivateKeyPath: caKeyPath,
|
||||||
ClientCertPath: clientCertPath,
|
ClientCertPath: clientCertPath,
|
||||||
|
|
|
@ -16,14 +16,14 @@ import (
|
||||||
// ErrCertInvalid for when the cert is computed to be invalid.
|
// ErrCertInvalid for when the cert is computed to be invalid.
|
||||||
type ErrCertInvalid struct {
|
type ErrCertInvalid struct {
|
||||||
wrappedErr error
|
wrappedErr error
|
||||||
hostUrl string
|
hostURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e ErrCertInvalid) Error() string {
|
func (e ErrCertInvalid) Error() string {
|
||||||
return fmt.Sprintf(`There was an error validating certificates for host %q: %s
|
return fmt.Sprintf(`There was an error validating certificates for host %q: %s
|
||||||
You can attempt to regenerate them using 'docker-machine regenerate-certs name'.
|
You can attempt to regenerate them using 'docker-machine regenerate-certs name'.
|
||||||
Be advised that this will trigger a Docker daemon restart which will stop running containers.
|
Be advised that this will trigger a Docker daemon restart which will stop running containers.
|
||||||
`, e.hostUrl, e.wrappedErr)
|
`, e.hostURL, e.wrappedErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdConfig(c CommandLine) error {
|
func cmdConfig(c CommandLine) error {
|
||||||
|
@ -53,50 +53,50 @@ func cmdConfig(c CommandLine) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func runConnectionBoilerplate(h *host.Host, c CommandLine) (string, *auth.AuthOptions, error) {
|
func runConnectionBoilerplate(h *host.Host, c CommandLine) (string, *auth.Options, error) {
|
||||||
hostState, err := h.Driver.GetState()
|
hostState, err := h.Driver.GetState()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: This is a common operation and should have a commonly
|
// TODO: This is a common operation and should have a commonly
|
||||||
// defined error.
|
// defined error.
|
||||||
return "", &auth.AuthOptions{}, fmt.Errorf("Error trying to get host state: %s", err)
|
return "", &auth.Options{}, fmt.Errorf("Error trying to get host state: %s", err)
|
||||||
}
|
}
|
||||||
if hostState != state.Running {
|
if hostState != state.Running {
|
||||||
return "", &auth.AuthOptions{}, fmt.Errorf("%s is not running. Please start it in order to use the connection settings", h.Name)
|
return "", &auth.Options{}, fmt.Errorf("%s is not running. Please start it in order to use the connection settings", h.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerHost, err := h.Driver.GetURL()
|
dockerHost, err := h.Driver.GetURL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", &auth.AuthOptions{}, fmt.Errorf("Error getting driver URL: %s", err)
|
return "", &auth.Options{}, fmt.Errorf("Error getting driver URL: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Bool("swarm") {
|
if c.Bool("swarm") {
|
||||||
var err error
|
var err error
|
||||||
dockerHost, err = parseSwarm(dockerHost, h)
|
dockerHost, err = parseSwarm(dockerHost, h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", &auth.AuthOptions{}, fmt.Errorf("Error parsing swarm: %s", err)
|
return "", &auth.Options{}, fmt.Errorf("Error parsing swarm: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := url.Parse(dockerHost)
|
u, err := url.Parse(dockerHost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", &auth.AuthOptions{}, fmt.Errorf("Error parsing URL: %s", err)
|
return "", &auth.Options{}, fmt.Errorf("Error parsing URL: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
authOptions := h.HostOptions.AuthOptions
|
authOptions := h.HostOptions.AuthOptions
|
||||||
|
|
||||||
if err := checkCert(u.Host, authOptions); err != nil {
|
if err := checkCert(u.Host, authOptions); err != nil {
|
||||||
return "", &auth.AuthOptions{}, fmt.Errorf("Error checking and/or regenerating the certs: %s", err)
|
return "", &auth.Options{}, fmt.Errorf("Error checking and/or regenerating the certs: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return dockerHost, authOptions, nil
|
return dockerHost, authOptions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkCert(hostUrl string, authOptions *auth.AuthOptions) error {
|
func checkCert(hostURL string, authOptions *auth.Options) error {
|
||||||
valid, err := cert.ValidateCertificate(hostUrl, authOptions)
|
valid, err := cert.ValidateCertificate(hostURL, authOptions)
|
||||||
if !valid || err != nil {
|
if !valid || err != nil {
|
||||||
return ErrCertInvalid{
|
return ErrCertInvalid{
|
||||||
wrappedErr: err,
|
wrappedErr: err,
|
||||||
hostUrl: hostUrl,
|
hostURL: hostURL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ func checkCert(hostUrl string, authOptions *auth.AuthOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This could use a unit test.
|
// TODO: This could use a unit test.
|
||||||
func parseSwarm(hostUrl string, h *host.Host) (string, error) {
|
func parseSwarm(hostURL string, h *host.Host) (string, error) {
|
||||||
swarmOptions := h.HostOptions.SwarmOptions
|
swarmOptions := h.HostOptions.SwarmOptions
|
||||||
|
|
||||||
if !swarmOptions.Master {
|
if !swarmOptions.Master {
|
||||||
|
@ -119,15 +119,15 @@ func parseSwarm(hostUrl string, h *host.Host) (string, error) {
|
||||||
swarmPort := parts[1]
|
swarmPort := parts[1]
|
||||||
|
|
||||||
// get IP of machine to replace in case swarm host is 0.0.0.0
|
// get IP of machine to replace in case swarm host is 0.0.0.0
|
||||||
mUrl, err := url.Parse(hostUrl)
|
mURL, err := url.Parse(hostURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("There was an error parsing the url: %s", err)
|
return "", fmt.Errorf("There was an error parsing the url: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mParts := strings.Split(mUrl.Host, ":")
|
mParts := strings.Split(mURL.Host, ":")
|
||||||
machineIp := mParts[0]
|
machineIP := mParts[0]
|
||||||
|
|
||||||
hostUrl = fmt.Sprintf("tcp://%s:%s", machineIp, swarmPort)
|
hostURL = fmt.Sprintf("tcp://%s:%s", machineIP, swarmPort)
|
||||||
|
|
||||||
return hostUrl, nil
|
return hostURL, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func (fcg FakeCertGenerator) GenerateCert(hosts []string, certFile, keyFile, caF
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fcg FakeCertGenerator) ValidateCertificate(addr string, authOptions *auth.AuthOptions) (bool, error) {
|
func (fcg FakeCertGenerator) ValidateCertificate(addr string, authOptions *auth.Options) (bool, error) {
|
||||||
return fcg.fakeValidateCertificate.IsValid, fcg.fakeValidateCertificate.Err
|
return fcg.fakeValidateCertificate.IsValid, fcg.fakeValidateCertificate.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,21 +34,21 @@ func TestCheckCert(t *testing.T) {
|
||||||
errCertsExpired := errors.New("Certs have expired")
|
errCertsExpired := errors.New("Certs have expired")
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
hostUrl string
|
hostURL string
|
||||||
authOptions *auth.AuthOptions
|
authOptions *auth.Options
|
||||||
valid bool
|
valid bool
|
||||||
checkErr error
|
checkErr error
|
||||||
expectedErr error
|
expectedErr error
|
||||||
}{
|
}{
|
||||||
{"192.168.99.100:2376", &auth.AuthOptions{}, true, nil, nil},
|
{"192.168.99.100:2376", &auth.Options{}, true, nil, nil},
|
||||||
{"192.168.99.100:2376", &auth.AuthOptions{}, false, nil, ErrCertInvalid{wrappedErr: nil, hostUrl: "192.168.99.100:2376"}},
|
{"192.168.99.100:2376", &auth.Options{}, false, nil, ErrCertInvalid{wrappedErr: nil, hostURL: "192.168.99.100:2376"}},
|
||||||
{"192.168.99.100:2376", &auth.AuthOptions{}, false, errCertsExpired, ErrCertInvalid{wrappedErr: errCertsExpired, hostUrl: "192.168.99.100:2376"}},
|
{"192.168.99.100:2376", &auth.Options{}, false, errCertsExpired, ErrCertInvalid{wrappedErr: errCertsExpired, hostURL: "192.168.99.100:2376"}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
fcg := FakeCertGenerator{fakeValidateCertificate: &FakeValidateCertificate{c.valid, c.checkErr}}
|
fcg := FakeCertGenerator{fakeValidateCertificate: &FakeValidateCertificate{c.valid, c.checkErr}}
|
||||||
cert.SetCertGenerator(fcg)
|
cert.SetCertGenerator(fcg)
|
||||||
err := checkCert(c.hostUrl, c.authOptions)
|
err := checkCert(c.hostURL, c.authOptions)
|
||||||
assert.Equal(t, c.expectedErr, err)
|
assert.Equal(t, c.expectedErr, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,8 +168,8 @@ func cmdCreateInner(c CommandLine) error {
|
||||||
return fmt.Errorf("Error getting new host: %s", err)
|
return fmt.Errorf("Error getting new host: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
h.HostOptions = &host.HostOptions{
|
h.HostOptions = &host.Options{
|
||||||
AuthOptions: &auth.AuthOptions{
|
AuthOptions: &auth.Options{
|
||||||
CertDir: mcndirs.GetMachineCertDir(),
|
CertDir: mcndirs.GetMachineCertDir(),
|
||||||
CaCertPath: certInfo.CaCertPath,
|
CaCertPath: certInfo.CaCertPath,
|
||||||
CaPrivateKeyPath: certInfo.CaPrivateKeyPath,
|
CaPrivateKeyPath: certInfo.CaPrivateKeyPath,
|
||||||
|
@ -179,17 +179,17 @@ func cmdCreateInner(c CommandLine) error {
|
||||||
ServerKeyPath: filepath.Join(mcndirs.GetMachineDir(), name, "server-key.pem"),
|
ServerKeyPath: filepath.Join(mcndirs.GetMachineDir(), name, "server-key.pem"),
|
||||||
StorePath: filepath.Join(mcndirs.GetMachineDir(), name),
|
StorePath: filepath.Join(mcndirs.GetMachineDir(), name),
|
||||||
},
|
},
|
||||||
EngineOptions: &engine.EngineOptions{
|
EngineOptions: &engine.Options{
|
||||||
ArbitraryFlags: c.StringSlice("engine-opt"),
|
ArbitraryFlags: c.StringSlice("engine-opt"),
|
||||||
Env: c.StringSlice("engine-env"),
|
Env: c.StringSlice("engine-env"),
|
||||||
InsecureRegistry: c.StringSlice("engine-insecure-registry"),
|
InsecureRegistry: c.StringSlice("engine-insecure-registry"),
|
||||||
Labels: c.StringSlice("engine-label"),
|
Labels: c.StringSlice("engine-label"),
|
||||||
RegistryMirror: c.StringSlice("engine-registry-mirror"),
|
RegistryMirror: c.StringSlice("engine-registry-mirror"),
|
||||||
StorageDriver: c.String("engine-storage-driver"),
|
StorageDriver: c.String("engine-storage-driver"),
|
||||||
TlsVerify: true,
|
TLSVerify: true,
|
||||||
InstallURL: c.String("engine-install-url"),
|
InstallURL: c.String("engine-install-url"),
|
||||||
},
|
},
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
IsSwarm: c.Bool("swarm"),
|
IsSwarm: c.Bool("swarm"),
|
||||||
Image: c.String("swarm-image"),
|
Image: c.String("swarm-image"),
|
||||||
Master: c.Bool("swarm-master"),
|
Master: c.Bool("swarm-master"),
|
||||||
|
|
|
@ -36,7 +36,7 @@ type HostListItem struct {
|
||||||
DriverName string
|
DriverName string
|
||||||
State state.State
|
State state.State
|
||||||
URL string
|
URL string
|
||||||
SwarmOptions *swarm.SwarmOptions
|
SwarmOptions *swarm.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdLs(c CommandLine) error {
|
func cmdLs(c CommandLine) error {
|
||||||
|
|
|
@ -73,7 +73,7 @@ func TestFilterHostsReturnsSameGivenNoFilters(t *testing.T) {
|
||||||
{
|
{
|
||||||
Name: "testhost",
|
Name: "testhost",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
actual := filterHosts(hosts, opts)
|
actual := filterHosts(hosts, opts)
|
||||||
|
@ -96,7 +96,7 @@ func TestFilterHostsReturnsEmptyGivenNonMatchingFilters(t *testing.T) {
|
||||||
{
|
{
|
||||||
Name: "testhost",
|
Name: "testhost",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
assert.Empty(t, filterHosts(hosts, opts))
|
assert.Empty(t, filterHosts(hosts, opts))
|
||||||
|
@ -109,22 +109,22 @@ func TestFilterHostsBySwarmName(t *testing.T) {
|
||||||
master :=
|
master :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "master",
|
Name: "master",
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{Master: true, Discovery: "foo"},
|
SwarmOptions: &swarm.Options{Master: true, Discovery: "foo"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
node1 :=
|
node1 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node1",
|
Name: "node1",
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{Master: false, Discovery: "foo"},
|
SwarmOptions: &swarm.Options{Master: false, Discovery: "foo"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
othermaster :=
|
othermaster :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "othermaster",
|
Name: "othermaster",
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{Master: true, Discovery: "bar"},
|
SwarmOptions: &swarm.Options{Master: true, Discovery: "bar"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
hosts := []*host.Host{master, node1, othermaster}
|
hosts := []*host.Host{master, node1, othermaster}
|
||||||
|
@ -141,19 +141,19 @@ func TestFilterHostsByDriverName(t *testing.T) {
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node1",
|
Name: "node1",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
}
|
}
|
||||||
node2 :=
|
node2 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node2",
|
Name: "node2",
|
||||||
DriverName: "virtualbox",
|
DriverName: "virtualbox",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
}
|
}
|
||||||
node3 :=
|
node3 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node3",
|
Name: "node3",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
}
|
}
|
||||||
hosts := []*host.Host{node1, node2, node3}
|
hosts := []*host.Host{node1, node2, node3}
|
||||||
expected := []*host.Host{node1, node3}
|
expected := []*host.Host{node1, node3}
|
||||||
|
@ -169,21 +169,21 @@ func TestFilterHostsByState(t *testing.T) {
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node1",
|
Name: "node1",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Paused},
|
Driver: &fakedriver.Driver{MockState: state.Paused},
|
||||||
}
|
}
|
||||||
node2 :=
|
node2 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node2",
|
Name: "node2",
|
||||||
DriverName: "virtualbox",
|
DriverName: "virtualbox",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Stopped},
|
Driver: &fakedriver.Driver{MockState: state.Stopped},
|
||||||
}
|
}
|
||||||
node3 :=
|
node3 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node3",
|
Name: "node3",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Running},
|
Driver: &fakedriver.Driver{MockState: state.Running},
|
||||||
}
|
}
|
||||||
hosts := []*host.Host{node1, node2, node3}
|
hosts := []*host.Host{node1, node2, node3}
|
||||||
|
@ -200,28 +200,28 @@ func TestFilterHostsByName(t *testing.T) {
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "fire",
|
Name: "fire",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "fire"},
|
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "fire"},
|
||||||
}
|
}
|
||||||
node2 :=
|
node2 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "ice",
|
Name: "ice",
|
||||||
DriverName: "adriver",
|
DriverName: "adriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "ice"},
|
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "ice"},
|
||||||
}
|
}
|
||||||
node3 :=
|
node3 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "air",
|
Name: "air",
|
||||||
DriverName: "nodriver",
|
DriverName: "nodriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "air"},
|
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "air"},
|
||||||
}
|
}
|
||||||
node4 :=
|
node4 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "water",
|
Name: "water",
|
||||||
DriverName: "falsedriver",
|
DriverName: "falsedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "water"},
|
Driver: &fakedriver.Driver{MockState: state.Paused, MockName: "water"},
|
||||||
}
|
}
|
||||||
hosts := []*host.Host{node1, node2, node3, node4}
|
hosts := []*host.Host{node1, node2, node3, node4}
|
||||||
|
@ -239,19 +239,19 @@ func TestFilterHostsMultiFlags(t *testing.T) {
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node1",
|
Name: "node1",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
}
|
}
|
||||||
node2 :=
|
node2 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node2",
|
Name: "node2",
|
||||||
DriverName: "virtualbox",
|
DriverName: "virtualbox",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
}
|
}
|
||||||
node3 :=
|
node3 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node3",
|
Name: "node3",
|
||||||
DriverName: "softlayer",
|
DriverName: "softlayer",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
}
|
}
|
||||||
hosts := []*host.Host{node1, node2, node3}
|
hosts := []*host.Host{node1, node2, node3}
|
||||||
expected := []*host.Host{node1, node2}
|
expected := []*host.Host{node1, node2}
|
||||||
|
@ -268,21 +268,21 @@ func TestFilterHostsDifferentFlagsProduceAND(t *testing.T) {
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node1",
|
Name: "node1",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Paused},
|
Driver: &fakedriver.Driver{MockState: state.Paused},
|
||||||
}
|
}
|
||||||
node2 :=
|
node2 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node2",
|
Name: "node2",
|
||||||
DriverName: "virtualbox",
|
DriverName: "virtualbox",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Stopped},
|
Driver: &fakedriver.Driver{MockState: state.Stopped},
|
||||||
}
|
}
|
||||||
node3 :=
|
node3 :=
|
||||||
&host.Host{
|
&host.Host{
|
||||||
Name: "node3",
|
Name: "node3",
|
||||||
DriverName: "fakedriver",
|
DriverName: "fakedriver",
|
||||||
HostOptions: &host.HostOptions{},
|
HostOptions: &host.Options{},
|
||||||
Driver: &fakedriver.Driver{MockState: state.Running},
|
Driver: &fakedriver.Driver{MockState: state.Running},
|
||||||
}
|
}
|
||||||
hosts := []*host.Host{node1, node2, node3}
|
hosts := []*host.Host{node1, node2, node3}
|
||||||
|
@ -317,8 +317,8 @@ func TestGetHostListItems(t *testing.T) {
|
||||||
Driver: &fakedriver.Driver{
|
Driver: &fakedriver.Driver{
|
||||||
MockState: state.Running,
|
MockState: state.Running,
|
||||||
},
|
},
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Master: false,
|
Master: false,
|
||||||
Address: "",
|
Address: "",
|
||||||
Discovery: "",
|
Discovery: "",
|
||||||
|
@ -331,8 +331,8 @@ func TestGetHostListItems(t *testing.T) {
|
||||||
Driver: &fakedriver.Driver{
|
Driver: &fakedriver.Driver{
|
||||||
MockState: state.Stopped,
|
MockState: state.Stopped,
|
||||||
},
|
},
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Master: false,
|
Master: false,
|
||||||
Address: "",
|
Address: "",
|
||||||
Discovery: "",
|
Discovery: "",
|
||||||
|
@ -345,8 +345,8 @@ func TestGetHostListItems(t *testing.T) {
|
||||||
Driver: &fakedriver.Driver{
|
Driver: &fakedriver.Driver{
|
||||||
MockState: state.Running,
|
MockState: state.Running,
|
||||||
},
|
},
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Master: false,
|
Master: false,
|
||||||
Address: "",
|
Address: "",
|
||||||
Discovery: "",
|
Discovery: "",
|
||||||
|
@ -400,8 +400,8 @@ func TestGetHostListItemsEnvDockerHostUnset(t *testing.T) {
|
||||||
MockState: state.Running,
|
MockState: state.Running,
|
||||||
MockURL: "tcp://120.0.0.1:2376",
|
MockURL: "tcp://120.0.0.1:2376",
|
||||||
},
|
},
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Master: false,
|
Master: false,
|
||||||
Address: "",
|
Address: "",
|
||||||
Discovery: "",
|
Discovery: "",
|
||||||
|
@ -414,8 +414,8 @@ func TestGetHostListItemsEnvDockerHostUnset(t *testing.T) {
|
||||||
Driver: &fakedriver.Driver{
|
Driver: &fakedriver.Driver{
|
||||||
MockState: state.Stopped,
|
MockState: state.Stopped,
|
||||||
},
|
},
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Master: false,
|
Master: false,
|
||||||
Address: "",
|
Address: "",
|
||||||
Discovery: "",
|
Discovery: "",
|
||||||
|
@ -428,8 +428,8 @@ func TestGetHostListItemsEnvDockerHostUnset(t *testing.T) {
|
||||||
Driver: &fakedriver.Driver{
|
Driver: &fakedriver.Driver{
|
||||||
MockState: state.Saved,
|
MockState: state.Saved,
|
||||||
},
|
},
|
||||||
HostOptions: &host.HostOptions{
|
HostOptions: &host.Options{
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Master: false,
|
Master: false,
|
||||||
Address: "",
|
Address: "",
|
||||||
Discovery: "",
|
Discovery: "",
|
||||||
|
|
|
@ -505,7 +505,7 @@ func (c *GenericClient) Authenticate(d *Driver) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
provider.UserAgent.Prepend(fmt.Sprintf("docker-machine/v%d", version.ApiVersion))
|
provider.UserAgent.Prepend(fmt.Sprintf("docker-machine/v%d", version.APIVersion))
|
||||||
|
|
||||||
if d.Insecure {
|
if d.Insecure {
|
||||||
// Configure custom TLS settings.
|
// Configure custom TLS settings.
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (c *Client) Authenticate(d *openstack.Driver) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
provider.UserAgent.Prepend(fmt.Sprintf("docker-machine/v%d", version.ApiVersion))
|
provider.UserAgent.Prepend(fmt.Sprintf("docker-machine/v%d", version.APIVersion))
|
||||||
|
|
||||||
err = rackspace.Authenticate(provider, opts)
|
err = rackspace.Authenticate(provider, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package auth
|
package auth
|
||||||
|
|
||||||
type AuthOptions struct {
|
type Options struct {
|
||||||
CertDir string
|
CertDir string
|
||||||
CaCertPath string
|
CaCertPath string
|
||||||
CaPrivateKeyPath string
|
CaPrivateKeyPath string
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/docker/machine/libmachine/mcnutils"
|
"github.com/docker/machine/libmachine/mcnutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BootstrapCertificates(authOptions *auth.AuthOptions) error {
|
func BootstrapCertificates(authOptions *auth.Options) error {
|
||||||
certDir := authOptions.CertDir
|
certDir := authOptions.CertDir
|
||||||
caCertPath := authOptions.CaCertPath
|
caCertPath := authOptions.CaCertPath
|
||||||
caPrivateKeyPath := authOptions.CaPrivateKeyPath
|
caPrivateKeyPath := authOptions.CaPrivateKeyPath
|
||||||
|
|
|
@ -21,15 +21,15 @@ import (
|
||||||
|
|
||||||
var defaultGenerator = NewX509CertGenerator()
|
var defaultGenerator = NewX509CertGenerator()
|
||||||
|
|
||||||
type CertGenerator interface {
|
type Generator interface {
|
||||||
GenerateCACertificate(certFile, keyFile, org string, bits int) error
|
GenerateCACertificate(certFile, keyFile, org string, bits int) error
|
||||||
GenerateCert(hosts []string, certFile, keyFile, caFile, caKeyFile, org string, bits int) error
|
GenerateCert(hosts []string, certFile, keyFile, caFile, caKeyFile, org string, bits int) error
|
||||||
ValidateCertificate(addr string, authOptions *auth.AuthOptions) (bool, error)
|
ValidateCertificate(addr string, authOptions *auth.Options) (bool, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type X509CertGenerator struct{}
|
type X509CertGenerator struct{}
|
||||||
|
|
||||||
func NewX509CertGenerator() CertGenerator {
|
func NewX509CertGenerator() Generator {
|
||||||
return &X509CertGenerator{}
|
return &X509CertGenerator{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ func GenerateCert(hosts []string, certFile, keyFile, caFile, caKeyFile, org stri
|
||||||
return defaultGenerator.GenerateCert(hosts, certFile, keyFile, caFile, caKeyFile, org, bits)
|
return defaultGenerator.GenerateCert(hosts, certFile, keyFile, caFile, caKeyFile, org, bits)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateCertificate(addr string, authOptions *auth.AuthOptions) (bool, error) {
|
func ValidateCertificate(addr string, authOptions *auth.Options) (bool, error) {
|
||||||
return defaultGenerator.ValidateCertificate(addr, authOptions)
|
return defaultGenerator.ValidateCertificate(addr, authOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetCertGenerator(cg CertGenerator) {
|
func SetCertGenerator(cg Generator) {
|
||||||
defaultGenerator = cg
|
defaultGenerator = cg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ func (xcg *X509CertGenerator) GenerateCert(hosts []string, certFile, keyFile, ca
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateCertificate validate the certificate installed on the vm.
|
// ValidateCertificate validate the certificate installed on the vm.
|
||||||
func (xcg *X509CertGenerator) ValidateCertificate(addr string, authOptions *auth.AuthOptions) (bool, error) {
|
func (xcg *X509CertGenerator) ValidateCertificate(addr string, authOptions *auth.Options) (bool, error) {
|
||||||
caCertPath := authOptions.CaCertPath
|
caCertPath := authOptions.CaCertPath
|
||||||
serverCertPath := authOptions.ServerCertPath
|
serverCertPath := authOptions.ServerCertPath
|
||||||
serverKeyPath := authOptions.ServerKeyPath
|
serverKeyPath := authOptions.ServerKeyPath
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package cert
|
package cert
|
||||||
|
|
||||||
type CertPathInfo struct {
|
type PathInfo struct {
|
||||||
CaCertPath string
|
CaCertPath string
|
||||||
CaPrivateKeyPath string
|
CaPrivateKeyPath string
|
||||||
ClientCertPath string
|
ClientCertPath string
|
||||||
|
|
|
@ -25,7 +25,7 @@ func RegisterDriver(d drivers.Driver) {
|
||||||
Plugin binaries are not intended to be invoked directly.
|
Plugin binaries are not intended to be invoked directly.
|
||||||
Please use this plugin through the main 'docker-machine' binary.
|
Please use this plugin through the main 'docker-machine' binary.
|
||||||
(API version: %d)
|
(API version: %d)
|
||||||
`, version.ApiVersion)
|
`, version.APIVersion)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ func NewRpcClientDriver(rawDriverData []byte, driverName string) (*RpcClientDriv
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if serverVersion != version.ApiVersion {
|
if serverVersion != version.APIVersion {
|
||||||
return nil, fmt.Errorf("Driver binary uses an incompatible API version (%d)", serverVersion)
|
return nil, fmt.Errorf("Driver binary uses an incompatible API version (%d)", serverVersion)
|
||||||
}
|
}
|
||||||
log.Debug("Using API Version ", serverVersion)
|
log.Debug("Using API Version ", serverVersion)
|
||||||
|
|
|
@ -84,7 +84,7 @@ func (r *RpcServerDriver) Close(_, _ *struct{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RpcServerDriver) GetVersion(_ *struct{}, reply *int) error {
|
func (r *RpcServerDriver) GetVersion(_ *struct{}, reply *int) error {
|
||||||
*reply = version.ApiVersion
|
*reply = version.APIVersion
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package engine
|
package engine
|
||||||
|
|
||||||
type EngineOptions struct {
|
type Options struct {
|
||||||
ArbitraryFlags []string
|
ArbitraryFlags []string
|
||||||
Dns []string
|
DNS []string `json:"Dns"`
|
||||||
GraphDir string
|
GraphDir string
|
||||||
Env []string
|
Env []string
|
||||||
Ipv6 bool
|
Ipv6 bool
|
||||||
|
@ -11,7 +11,7 @@ type EngineOptions struct {
|
||||||
LogLevel string
|
LogLevel string
|
||||||
StorageDriver string
|
StorageDriver string
|
||||||
SelinuxEnabled bool
|
SelinuxEnabled bool
|
||||||
TlsVerify bool
|
TLSVerify bool `json:"TlsVerify"`
|
||||||
RegistryMirror []string
|
RegistryMirror []string
|
||||||
InstallURL string
|
InstallURL string
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,24 +28,24 @@ type Host struct {
|
||||||
ConfigVersion int
|
ConfigVersion int
|
||||||
Driver drivers.Driver
|
Driver drivers.Driver
|
||||||
DriverName string
|
DriverName string
|
||||||
HostOptions *HostOptions
|
HostOptions *Options
|
||||||
Name string
|
Name string
|
||||||
RawDriver []byte
|
RawDriver []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostOptions struct {
|
type Options struct {
|
||||||
Driver string
|
Driver string
|
||||||
Memory int
|
Memory int
|
||||||
Disk int
|
Disk int
|
||||||
EngineOptions *engine.EngineOptions
|
EngineOptions *engine.Options
|
||||||
SwarmOptions *swarm.SwarmOptions
|
SwarmOptions *swarm.Options
|
||||||
AuthOptions *auth.AuthOptions
|
AuthOptions *auth.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostMetadata struct {
|
type Metadata struct {
|
||||||
ConfigVersion int
|
ConfigVersion int
|
||||||
DriverName string
|
DriverName string
|
||||||
HostOptions HostOptions
|
HostOptions Options
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateHostName(name string) bool {
|
func ValidateHostName(name string) bool {
|
||||||
|
@ -160,7 +160,7 @@ func (h *Host) ConfigureAuth() error {
|
||||||
// and modularity of the provisioners should be).
|
// and modularity of the provisioners should be).
|
||||||
//
|
//
|
||||||
// Call provision to re-provision the certs properly.
|
// Call provision to re-provision the certs properly.
|
||||||
if err := provisioner.Provision(swarm.SwarmOptions{}, *h.HostOptions.AuthOptions, *h.HostOptions.EngineOptions); err != nil {
|
if err := provisioner.Provision(swarm.Options{}, *h.HostOptions.AuthOptions, *h.HostOptions.EngineOptions); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@ package host
|
||||||
|
|
||||||
import "github.com/docker/machine/libmachine/drivers"
|
import "github.com/docker/machine/libmachine/drivers"
|
||||||
|
|
||||||
type HostV0 struct {
|
type V0 struct {
|
||||||
Name string `json:"-"`
|
Name string `json:"-"`
|
||||||
Driver drivers.Driver
|
Driver drivers.Driver
|
||||||
DriverName string
|
DriverName string
|
||||||
ConfigVersion int
|
ConfigVersion int
|
||||||
HostOptions *HostOptions
|
HostOptions *Options
|
||||||
|
|
||||||
StorePath string
|
StorePath string
|
||||||
CaCertPath string
|
CaCertPath string
|
||||||
|
@ -21,8 +21,8 @@ type HostV0 struct {
|
||||||
ClientKeyPath string
|
ClientKeyPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostMetadataV0 struct {
|
type MetadataV0 struct {
|
||||||
HostOptions HostOptions
|
HostOptions Options
|
||||||
DriverName string
|
DriverName string
|
||||||
|
|
||||||
ConfigVersion int
|
ConfigVersion int
|
||||||
|
|
|
@ -2,10 +2,10 @@ package host
|
||||||
|
|
||||||
import "github.com/docker/machine/libmachine/drivers"
|
import "github.com/docker/machine/libmachine/drivers"
|
||||||
|
|
||||||
type HostV2 struct {
|
type V2 struct {
|
||||||
ConfigVersion int
|
ConfigVersion int
|
||||||
Driver drivers.Driver
|
Driver drivers.Driver
|
||||||
DriverName string
|
DriverName string
|
||||||
HostOptions *HostOptions
|
HostOptions *Options
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,14 @@ func (r *RawDataDriver) MarshalJSON() ([]byte, error) {
|
||||||
return r.data, nil
|
return r.data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMigratedHostMetadata(data []byte) (*HostMetadata, error) {
|
func getMigratedHostMetadata(data []byte) (*Metadata, error) {
|
||||||
// HostMetadata is for a "first pass" so we can then load the driver
|
// HostMetadata is for a "first pass" so we can then load the driver
|
||||||
var (
|
var (
|
||||||
hostMetadata *HostMetadataV0
|
hostMetadata *MetadataV0
|
||||||
)
|
)
|
||||||
|
|
||||||
if err := json.Unmarshal(data, &hostMetadata); err != nil {
|
if err := json.Unmarshal(data, &hostMetadata); err != nil {
|
||||||
return &HostMetadata{}, err
|
return &Metadata{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
migratedHostMetadata := MigrateHostMetadataV0ToHostMetadataV1(hostMetadata)
|
migratedHostMetadata := MigrateHostMetadataV0ToHostMetadataV1(hostMetadata)
|
||||||
|
@ -40,8 +40,8 @@ func MigrateHost(h *Host, data []byte) (*Host, bool, error) {
|
||||||
var (
|
var (
|
||||||
migrationNeeded = false
|
migrationNeeded = false
|
||||||
migrationPerformed = false
|
migrationPerformed = false
|
||||||
hostV1 *HostV1
|
hostV1 *V1
|
||||||
hostV2 *HostV2
|
hostV2 *V2
|
||||||
)
|
)
|
||||||
|
|
||||||
migratedHostMetadata, err := getMigratedHostMetadata(data)
|
migratedHostMetadata, err := getMigratedHostMetadata(data)
|
||||||
|
@ -90,7 +90,7 @@ func MigrateHost(h *Host, data []byte) (*Host, bool, error) {
|
||||||
log.Debugf("Migrating to config v%d", h.ConfigVersion)
|
log.Debugf("Migrating to config v%d", h.ConfigVersion)
|
||||||
switch h.ConfigVersion {
|
switch h.ConfigVersion {
|
||||||
case 0:
|
case 0:
|
||||||
hostV0 := &HostV0{
|
hostV0 := &V0{
|
||||||
Driver: driver,
|
Driver: driver,
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(data, &hostV0); err != nil {
|
if err := json.Unmarshal(data, &hostV0); err != nil {
|
||||||
|
@ -99,7 +99,7 @@ func MigrateHost(h *Host, data []byte) (*Host, bool, error) {
|
||||||
hostV1 = MigrateHostV0ToHostV1(hostV0)
|
hostV1 = MigrateHostV0ToHostV1(hostV0)
|
||||||
case 1:
|
case 1:
|
||||||
if hostV1 == nil {
|
if hostV1 == nil {
|
||||||
hostV1 = &HostV1{
|
hostV1 = &V1{
|
||||||
Driver: driver,
|
Driver: driver,
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(data, &hostV1); err != nil {
|
if err := json.Unmarshal(data, &hostV1); err != nil {
|
||||||
|
@ -109,7 +109,7 @@ func MigrateHost(h *Host, data []byte) (*Host, bool, error) {
|
||||||
hostV2 = MigrateHostV1ToHostV2(hostV1)
|
hostV2 = MigrateHostV1ToHostV2(hostV1)
|
||||||
case 2:
|
case 2:
|
||||||
if hostV2 == nil {
|
if hostV2 == nil {
|
||||||
hostV2 = &HostV2{
|
hostV2 = &V2{
|
||||||
Driver: driver,
|
Driver: driver,
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(data, &hostV2); err != nil {
|
if err := json.Unmarshal(data, &hostV2); err != nil {
|
||||||
|
|
|
@ -13,20 +13,20 @@ import (
|
||||||
// have been introduced. They preserve backwards compat at the expense
|
// have been introduced. They preserve backwards compat at the expense
|
||||||
// of some duplicated information.
|
// of some duplicated information.
|
||||||
|
|
||||||
// validates host config and modifies if needed
|
// MigrateHostV0ToHostV1 validates host config and modifies if needed
|
||||||
// this is used for configuration updates
|
// this is used for configuration updates
|
||||||
func MigrateHostV0ToHostV1(hostV0 *HostV0) *HostV1 {
|
func MigrateHostV0ToHostV1(hostV0 *V0) *V1 {
|
||||||
hostV1 := &HostV1{
|
hostV1 := &V1{
|
||||||
Driver: hostV0.Driver,
|
Driver: hostV0.Driver,
|
||||||
DriverName: hostV0.DriverName,
|
DriverName: hostV0.DriverName,
|
||||||
}
|
}
|
||||||
|
|
||||||
hostV1.HostOptions = &HostOptionsV1{}
|
hostV1.HostOptions = &OptionsV1{}
|
||||||
hostV1.HostOptions.EngineOptions = &engine.EngineOptions{
|
hostV1.HostOptions.EngineOptions = &engine.Options{
|
||||||
TlsVerify: true,
|
TLSVerify: true,
|
||||||
InstallURL: "https://get.docker.com",
|
InstallURL: "https://get.docker.com",
|
||||||
}
|
}
|
||||||
hostV1.HostOptions.SwarmOptions = &swarm.SwarmOptions{
|
hostV1.HostOptions.SwarmOptions = &swarm.Options{
|
||||||
Address: "",
|
Address: "",
|
||||||
Discovery: hostV0.SwarmDiscovery,
|
Discovery: hostV0.SwarmDiscovery,
|
||||||
Host: hostV0.SwarmHost,
|
Host: hostV0.SwarmHost,
|
||||||
|
@ -48,13 +48,13 @@ func MigrateHostV0ToHostV1(hostV0 *HostV0) *HostV1 {
|
||||||
return hostV1
|
return hostV1
|
||||||
}
|
}
|
||||||
|
|
||||||
// fills nested host metadata and modifies if needed
|
// MigrateHostMetadataV0ToHostMetadataV1 fills nested host metadata and modifies if needed
|
||||||
// this is used for configuration updates
|
// this is used for configuration updates
|
||||||
func MigrateHostMetadataV0ToHostMetadataV1(m *HostMetadataV0) *HostMetadata {
|
func MigrateHostMetadataV0ToHostMetadataV1(m *MetadataV0) *Metadata {
|
||||||
hostMetadata := &HostMetadata{}
|
hostMetadata := &Metadata{}
|
||||||
hostMetadata.DriverName = m.DriverName
|
hostMetadata.DriverName = m.DriverName
|
||||||
hostMetadata.HostOptions.EngineOptions = &engine.EngineOptions{}
|
hostMetadata.HostOptions.EngineOptions = &engine.Options{}
|
||||||
hostMetadata.HostOptions.AuthOptions = &auth.AuthOptions{
|
hostMetadata.HostOptions.AuthOptions = &auth.Options{
|
||||||
StorePath: m.StorePath,
|
StorePath: m.StorePath,
|
||||||
CaCertPath: m.CaCertPath,
|
CaCertPath: m.CaCertPath,
|
||||||
CaCertRemotePath: "",
|
CaCertRemotePath: "",
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
func TestMigrateHostV0ToV1(t *testing.T) {
|
func TestMigrateHostV0ToV1(t *testing.T) {
|
||||||
mcndirs.BaseDir = "/tmp/migration"
|
mcndirs.BaseDir = "/tmp/migration"
|
||||||
originalHost := &HostV0{
|
originalHost := &V0{
|
||||||
HostOptions: nil,
|
HostOptions: nil,
|
||||||
SwarmDiscovery: "token://foobar",
|
SwarmDiscovery: "token://foobar",
|
||||||
SwarmHost: "1.2.3.4:2376",
|
SwarmHost: "1.2.3.4:2376",
|
||||||
|
@ -24,8 +24,8 @@ func TestMigrateHostV0ToV1(t *testing.T) {
|
||||||
ServerCertPath: "/tmp/migration/certs/server.pem",
|
ServerCertPath: "/tmp/migration/certs/server.pem",
|
||||||
ServerKeyPath: "/tmp/migration/certs/server-key.pem",
|
ServerKeyPath: "/tmp/migration/certs/server-key.pem",
|
||||||
}
|
}
|
||||||
hostOptions := &HostOptionsV1{
|
hostOptions := &OptionsV1{
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Master: true,
|
Master: true,
|
||||||
Discovery: "token://foobar",
|
Discovery: "token://foobar",
|
||||||
Host: "1.2.3.4:2376",
|
Host: "1.2.3.4:2376",
|
||||||
|
@ -38,13 +38,13 @@ func TestMigrateHostV0ToV1(t *testing.T) {
|
||||||
ServerCertPath: "/tmp/migration/certs/server.pem",
|
ServerCertPath: "/tmp/migration/certs/server.pem",
|
||||||
ServerKeyPath: "/tmp/migration/certs/server-key.pem",
|
ServerKeyPath: "/tmp/migration/certs/server-key.pem",
|
||||||
},
|
},
|
||||||
EngineOptions: &engine.EngineOptions{
|
EngineOptions: &engine.Options{
|
||||||
InstallURL: "https://get.docker.com",
|
InstallURL: "https://get.docker.com",
|
||||||
TlsVerify: true,
|
TLSVerify: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedHost := &HostV1{
|
expectedHost := &V1{
|
||||||
HostOptions: hostOptions,
|
HostOptions: hostOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ func TestMigrateHostV0ToV1(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMigrateHostMetadataV0ToV1(t *testing.T) {
|
func TestMigrateHostMetadataV0ToV1(t *testing.T) {
|
||||||
metadata := &HostMetadataV0{
|
metadata := &MetadataV0{
|
||||||
HostOptions: HostOptions{
|
HostOptions: Options{
|
||||||
EngineOptions: nil,
|
EngineOptions: nil,
|
||||||
AuthOptions: nil,
|
AuthOptions: nil,
|
||||||
},
|
},
|
||||||
|
@ -67,15 +67,15 @@ func TestMigrateHostMetadataV0ToV1(t *testing.T) {
|
||||||
CaCertPath: "/tmp/store/certs/ca.pem",
|
CaCertPath: "/tmp/store/certs/ca.pem",
|
||||||
ServerCertPath: "/tmp/store/certs/server.pem",
|
ServerCertPath: "/tmp/store/certs/server.pem",
|
||||||
}
|
}
|
||||||
expectedAuthOptions := &auth.AuthOptions{
|
expectedAuthOptions := &auth.Options{
|
||||||
StorePath: "/tmp/store",
|
StorePath: "/tmp/store",
|
||||||
CaCertPath: "/tmp/store/certs/ca.pem",
|
CaCertPath: "/tmp/store/certs/ca.pem",
|
||||||
ServerCertPath: "/tmp/store/certs/server.pem",
|
ServerCertPath: "/tmp/store/certs/server.pem",
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedMetadata := &HostMetadata{
|
expectedMetadata := &Metadata{
|
||||||
HostOptions: HostOptions{
|
HostOptions: Options{
|
||||||
EngineOptions: &engine.EngineOptions{},
|
EngineOptions: &engine.Options{},
|
||||||
AuthOptions: expectedAuthOptions,
|
AuthOptions: expectedAuthOptions,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,43 +22,43 @@ type AuthOptionsV1 struct {
|
||||||
ClientCertPath string
|
ClientCertPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostOptionsV1 struct {
|
type OptionsV1 struct {
|
||||||
Driver string
|
Driver string
|
||||||
Memory int
|
Memory int
|
||||||
Disk int
|
Disk int
|
||||||
EngineOptions *engine.EngineOptions
|
EngineOptions *engine.Options
|
||||||
SwarmOptions *swarm.SwarmOptions
|
SwarmOptions *swarm.Options
|
||||||
AuthOptions *AuthOptionsV1
|
AuthOptions *AuthOptionsV1
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostV1 struct {
|
type V1 struct {
|
||||||
ConfigVersion int
|
ConfigVersion int
|
||||||
Driver drivers.Driver
|
Driver drivers.Driver
|
||||||
DriverName string
|
DriverName string
|
||||||
HostOptions *HostOptionsV1
|
HostOptions *OptionsV1
|
||||||
Name string `json:"-"`
|
Name string `json:"-"`
|
||||||
StorePath string
|
StorePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
func MigrateHostV1ToHostV2(hostV1 *HostV1) *HostV2 {
|
func MigrateHostV1ToHostV2(hostV1 *V1) *V2 {
|
||||||
// Changed: Put StorePath directly in AuthOptions (for provisioning),
|
// Changed: Put StorePath directly in AuthOptions (for provisioning),
|
||||||
// and AuthOptions.PrivateKeyPath => AuthOptions.CaPrivateKeyPath
|
// and AuthOptions.PrivateKeyPath => AuthOptions.CaPrivateKeyPath
|
||||||
// Also, CertDir has been added.
|
// Also, CertDir has been added.
|
||||||
|
|
||||||
globalStorePath := filepath.Dir(filepath.Dir(hostV1.StorePath))
|
globalStorePath := filepath.Dir(filepath.Dir(hostV1.StorePath))
|
||||||
|
|
||||||
h := &HostV2{
|
h := &V2{
|
||||||
ConfigVersion: hostV1.ConfigVersion,
|
ConfigVersion: hostV1.ConfigVersion,
|
||||||
Driver: hostV1.Driver,
|
Driver: hostV1.Driver,
|
||||||
Name: hostV1.Driver.GetMachineName(),
|
Name: hostV1.Driver.GetMachineName(),
|
||||||
DriverName: hostV1.DriverName,
|
DriverName: hostV1.DriverName,
|
||||||
HostOptions: &HostOptions{
|
HostOptions: &Options{
|
||||||
Driver: hostV1.HostOptions.Driver,
|
Driver: hostV1.HostOptions.Driver,
|
||||||
Memory: hostV1.HostOptions.Memory,
|
Memory: hostV1.HostOptions.Memory,
|
||||||
Disk: hostV1.HostOptions.Disk,
|
Disk: hostV1.HostOptions.Disk,
|
||||||
EngineOptions: hostV1.HostOptions.EngineOptions,
|
EngineOptions: hostV1.HostOptions.EngineOptions,
|
||||||
SwarmOptions: hostV1.HostOptions.SwarmOptions,
|
SwarmOptions: hostV1.HostOptions.SwarmOptions,
|
||||||
AuthOptions: &auth.AuthOptions{
|
AuthOptions: &auth.Options{
|
||||||
CertDir: filepath.Join(globalStorePath, "certs"),
|
CertDir: filepath.Join(globalStorePath, "certs"),
|
||||||
CaCertPath: hostV1.HostOptions.AuthOptions.CaCertPath,
|
CaCertPath: hostV1.HostOptions.AuthOptions.CaCertPath,
|
||||||
CaPrivateKeyPath: hostV1.HostOptions.AuthOptions.PrivateKeyPath,
|
CaPrivateKeyPath: hostV1.HostOptions.AuthOptions.PrivateKeyPath,
|
||||||
|
|
|
@ -11,7 +11,7 @@ type RawHost struct {
|
||||||
Driver *json.RawMessage
|
Driver *json.RawMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
func MigrateHostV2ToHostV3(hostV2 *HostV2, data []byte, storePath string) *Host {
|
func MigrateHostV2ToHostV3(hostV2 *V2, data []byte, storePath string) *Host {
|
||||||
// Migrate to include RawDriver so that driver plugin will work
|
// Migrate to include RawDriver so that driver plugin will work
|
||||||
// smoothly.
|
// smoothly.
|
||||||
rawHost := &RawHost{}
|
rawHost := &RawHost{}
|
||||||
|
|
|
@ -51,10 +51,10 @@ func GetTestDriverFlags() *DriverOptionsMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultTestHost() (*host.Host, error) {
|
func GetDefaultTestHost() (*host.Host, error) {
|
||||||
hostOptions := &host.HostOptions{
|
hostOptions := &host.Options{
|
||||||
EngineOptions: &engine.EngineOptions{},
|
EngineOptions: &engine.Options{},
|
||||||
SwarmOptions: &swarm.SwarmOptions{},
|
SwarmOptions: &swarm.Options{},
|
||||||
AuthOptions: &auth.AuthOptions{
|
AuthOptions: &auth.Options{
|
||||||
CaCertPath: HostTestCaCert,
|
CaCertPath: HostTestCaCert,
|
||||||
CaPrivateKeyPath: HostTestPrivateKey,
|
CaPrivateKeyPath: HostTestPrivateKey,
|
||||||
},
|
},
|
||||||
|
|
|
@ -154,8 +154,8 @@ func (s Filestore) Load(name string) (*host.Host, error) {
|
||||||
func (s Filestore) NewHost(driver drivers.Driver) (*host.Host, error) {
|
func (s Filestore) NewHost(driver drivers.Driver) (*host.Host, error) {
|
||||||
certDir := filepath.Join(s.Path, "certs")
|
certDir := filepath.Join(s.Path, "certs")
|
||||||
|
|
||||||
hostOptions := &host.HostOptions{
|
hostOptions := &host.Options{
|
||||||
AuthOptions: &auth.AuthOptions{
|
AuthOptions: &auth.Options{
|
||||||
CertDir: certDir,
|
CertDir: certDir,
|
||||||
CaCertPath: filepath.Join(certDir, "ca.pem"),
|
CaCertPath: filepath.Join(certDir, "ca.pem"),
|
||||||
CaPrivateKeyPath: filepath.Join(certDir, "ca-key.pem"),
|
CaPrivateKeyPath: filepath.Join(certDir, "ca-key.pem"),
|
||||||
|
@ -164,12 +164,12 @@ func (s Filestore) NewHost(driver drivers.Driver) (*host.Host, error) {
|
||||||
ServerCertPath: filepath.Join(s.getMachinesDir(), "server.pem"),
|
ServerCertPath: filepath.Join(s.getMachinesDir(), "server.pem"),
|
||||||
ServerKeyPath: filepath.Join(s.getMachinesDir(), "server-key.pem"),
|
ServerKeyPath: filepath.Join(s.getMachinesDir(), "server-key.pem"),
|
||||||
},
|
},
|
||||||
EngineOptions: &engine.EngineOptions{
|
EngineOptions: &engine.Options{
|
||||||
InstallURL: "https://get.docker.com",
|
InstallURL: "https://get.docker.com",
|
||||||
StorageDriver: "aufs",
|
StorageDriver: "aufs",
|
||||||
TlsVerify: true,
|
TLSVerify: true,
|
||||||
},
|
},
|
||||||
SwarmOptions: &swarm.SwarmOptions{
|
SwarmOptions: &swarm.Options{
|
||||||
Host: "tcp://0.0.0.0:3376",
|
Host: "tcp://0.0.0.0:3376",
|
||||||
Image: "swarm:latest",
|
Image: "swarm:latest",
|
||||||
Strategy: "spread",
|
Strategy: "spread",
|
||||||
|
|
|
@ -26,7 +26,7 @@ func NewArchProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
||||||
OsReleaseId: "arch",
|
OsReleaseID: "arch",
|
||||||
Packages: []string{},
|
Packages: []string{},
|
||||||
Driver: d,
|
Driver: d,
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,7 @@ type ArchProvisioner struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *ArchProvisioner) CompatibleWithHost() bool {
|
func (provisioner *ArchProvisioner) CompatibleWithHost() bool {
|
||||||
return provisioner.OsReleaseInfo.Id == provisioner.OsReleaseId || provisioner.OsReleaseInfo.IdLike == provisioner.OsReleaseId
|
return provisioner.OsReleaseInfo.ID == provisioner.OsReleaseID || provisioner.OsReleaseInfo.IDLike == provisioner.OsReleaseID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *ArchProvisioner) Service(name string, action serviceaction.ServiceAction) error {
|
func (provisioner *ArchProvisioner) Service(name string, action serviceaction.ServiceAction) error {
|
||||||
|
@ -104,7 +104,7 @@ func (provisioner *ArchProvisioner) dockerDaemonResponding() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *ArchProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *ArchProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
provisioner.SwarmOptions = swarmOptions
|
provisioner.SwarmOptions = swarmOptions
|
||||||
provisioner.AuthOptions = authOptions
|
provisioner.AuthOptions = authOptions
|
||||||
provisioner.EngineOptions = engineOptions
|
provisioner.EngineOptions = engineOptions
|
||||||
|
|
|
@ -36,9 +36,9 @@ func NewBoot2DockerProvisioner(d drivers.Driver) Provisioner {
|
||||||
type Boot2DockerProvisioner struct {
|
type Boot2DockerProvisioner struct {
|
||||||
OsReleaseInfo *OsRelease
|
OsReleaseInfo *OsRelease
|
||||||
Driver drivers.Driver
|
Driver drivers.Driver
|
||||||
AuthOptions auth.AuthOptions
|
AuthOptions auth.Options
|
||||||
EngineOptions engine.EngineOptions
|
EngineOptions engine.Options
|
||||||
SwarmOptions swarm.SwarmOptions
|
SwarmOptions swarm.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *Boot2DockerProvisioner) Service(name string, action serviceaction.ServiceAction) error {
|
func (provisioner *Boot2DockerProvisioner) Service(name string, action serviceaction.ServiceAction) error {
|
||||||
|
@ -134,7 +134,7 @@ func (provisioner *Boot2DockerProvisioner) GetDockerOptionsDir() string {
|
||||||
return "/var/lib/boot2docker"
|
return "/var/lib/boot2docker"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *Boot2DockerProvisioner) GetAuthOptions() auth.AuthOptions {
|
func (provisioner *Boot2DockerProvisioner) GetAuthOptions() auth.Options {
|
||||||
return provisioner.AuthOptions
|
return provisioner.AuthOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ SERVERCERT={{.AuthOptions.ServerCertRemotePath}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *Boot2DockerProvisioner) CompatibleWithHost() bool {
|
func (provisioner *Boot2DockerProvisioner) CompatibleWithHost() bool {
|
||||||
return provisioner.OsReleaseInfo.Id == "boot2docker"
|
return provisioner.OsReleaseInfo.ID == "boot2docker"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *Boot2DockerProvisioner) SetOsReleaseInfo(info *OsRelease) {
|
func (provisioner *Boot2DockerProvisioner) SetOsReleaseInfo(info *OsRelease) {
|
||||||
|
@ -221,7 +221,7 @@ You also might want to clear any VirtualBox host only interfaces you are not usi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *Boot2DockerProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *Boot2DockerProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
const (
|
const (
|
||||||
dockerPort = 2376
|
dockerPort = 2376
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,7 +14,7 @@ func NewCentosProvisioner(d drivers.Driver) Provisioner {
|
||||||
g := GenericProvisioner{
|
g := GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
||||||
OsReleaseId: "centos",
|
OsReleaseID: "centos",
|
||||||
Packages: []string{},
|
Packages: []string{},
|
||||||
Driver: d,
|
Driver: d,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
func TestCentosGenerateYumRepoList(t *testing.T) {
|
func TestCentosGenerateYumRepoList(t *testing.T) {
|
||||||
info := &OsRelease{
|
info := &OsRelease{
|
||||||
Id: "centos",
|
ID: "centos",
|
||||||
}
|
}
|
||||||
p := NewCentosProvisioner(nil)
|
p := NewCentosProvisioner(nil)
|
||||||
p.SetOsReleaseInfo(info)
|
p.SetOsReleaseInfo(info)
|
||||||
|
|
|
@ -17,10 +17,10 @@ type SwarmCommandContext struct {
|
||||||
Env []string
|
Env []string
|
||||||
DockerDir string
|
DockerDir string
|
||||||
DockerPort int
|
DockerPort int
|
||||||
Ip string
|
IP string
|
||||||
Port string
|
Port string
|
||||||
AuthOptions auth.AuthOptions
|
AuthOptions auth.Options
|
||||||
SwarmOptions swarm.SwarmOptions
|
SwarmOptions swarm.Options
|
||||||
SwarmImage string
|
SwarmImage string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func runSwarmCommandFromTemplate(p Provisioner, cmdTmpl string, swarmCmdContext
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func configureSwarm(p Provisioner, swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions) error {
|
func configureSwarm(p Provisioner, swarmOptions swarm.Options, authOptions auth.Options) error {
|
||||||
if !swarmOptions.IsSwarm {
|
if !swarmOptions.IsSwarm {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ func configureSwarm(p Provisioner, swarmOptions swarm.SwarmOptions, authOptions
|
||||||
Env: swarmOptions.Env,
|
Env: swarmOptions.Env,
|
||||||
DockerDir: dockerDir,
|
DockerDir: dockerDir,
|
||||||
DockerPort: 2376,
|
DockerPort: 2376,
|
||||||
Ip: ip,
|
IP: ip,
|
||||||
Port: port,
|
Port: port,
|
||||||
AuthOptions: authOptions,
|
AuthOptions: authOptions,
|
||||||
SwarmOptions: swarmOptions,
|
SwarmOptions: swarmOptions,
|
||||||
|
|
|
@ -34,7 +34,7 @@ func NewCoreOSProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
||||||
OsReleaseId: "coreos",
|
OsReleaseID: "coreos",
|
||||||
Driver: d,
|
Driver: d,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ func (provisioner *CoreOSProvisioner) Package(name string, action pkgaction.Pack
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *CoreOSProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *CoreOSProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
provisioner.SwarmOptions = swarmOptions
|
provisioner.SwarmOptions = swarmOptions
|
||||||
provisioner.AuthOptions = authOptions
|
provisioner.AuthOptions = authOptions
|
||||||
provisioner.EngineOptions = engineOptions
|
provisioner.EngineOptions = engineOptions
|
||||||
|
|
|
@ -26,7 +26,7 @@ func NewDebianProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
||||||
OsReleaseId: "debian",
|
OsReleaseID: "debian",
|
||||||
Packages: []string{
|
Packages: []string{
|
||||||
"curl",
|
"curl",
|
||||||
},
|
},
|
||||||
|
@ -121,7 +121,7 @@ func (provisioner *DebianProvisioner) dockerDaemonResponding() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *DebianProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *DebianProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
provisioner.SwarmOptions = swarmOptions
|
provisioner.SwarmOptions = swarmOptions
|
||||||
provisioner.AuthOptions = authOptions
|
provisioner.AuthOptions = authOptions
|
||||||
provisioner.EngineOptions = engineOptions
|
provisioner.EngineOptions = engineOptions
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
type EngineConfigContext struct {
|
type EngineConfigContext struct {
|
||||||
DockerPort int
|
DockerPort int
|
||||||
AuthOptions auth.AuthOptions
|
AuthOptions auth.Options
|
||||||
EngineOptions engine.EngineOptions
|
EngineOptions engine.Options
|
||||||
DockerOptionsDir string
|
DockerOptionsDir string
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ func NewFedoraProvisioner(d drivers.Driver) Provisioner {
|
||||||
g := GenericProvisioner{
|
g := GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
||||||
OsReleaseId: "fedora",
|
OsReleaseID: "fedora",
|
||||||
Packages: []string{},
|
Packages: []string{},
|
||||||
Driver: d,
|
Driver: d,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
func TestFedoraGenerateYumRepoList(t *testing.T) {
|
func TestFedoraGenerateYumRepoList(t *testing.T) {
|
||||||
info := &OsRelease{
|
info := &OsRelease{
|
||||||
Id: "fedora",
|
ID: "fedora",
|
||||||
}
|
}
|
||||||
p := NewCentosProvisioner(nil)
|
p := NewCentosProvisioner(nil)
|
||||||
p.SetOsReleaseInfo(info)
|
p.SetOsReleaseInfo(info)
|
||||||
|
|
|
@ -12,15 +12,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type GenericProvisioner struct {
|
type GenericProvisioner struct {
|
||||||
OsReleaseId string
|
OsReleaseID string
|
||||||
DockerOptionsDir string
|
DockerOptionsDir string
|
||||||
DaemonOptionsFile string
|
DaemonOptionsFile string
|
||||||
Packages []string
|
Packages []string
|
||||||
OsReleaseInfo *OsRelease
|
OsReleaseInfo *OsRelease
|
||||||
Driver drivers.Driver
|
Driver drivers.Driver
|
||||||
AuthOptions auth.AuthOptions
|
AuthOptions auth.Options
|
||||||
EngineOptions engine.EngineOptions
|
EngineOptions engine.Options
|
||||||
SwarmOptions swarm.SwarmOptions
|
SwarmOptions swarm.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *GenericProvisioner) Hostname() (string, error) {
|
func (provisioner *GenericProvisioner) Hostname() (string, error) {
|
||||||
|
@ -57,10 +57,10 @@ func (provisioner *GenericProvisioner) SSHCommand(args string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *GenericProvisioner) CompatibleWithHost() bool {
|
func (provisioner *GenericProvisioner) CompatibleWithHost() bool {
|
||||||
return provisioner.OsReleaseInfo.Id == provisioner.OsReleaseId
|
return provisioner.OsReleaseInfo.ID == provisioner.OsReleaseID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *GenericProvisioner) GetAuthOptions() auth.AuthOptions {
|
func (provisioner *GenericProvisioner) GetAuthOptions() auth.Options {
|
||||||
return provisioner.AuthOptions
|
return provisioner.AuthOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@ type OsRelease struct {
|
||||||
AnsiColor string `osr:"ANSI_COLOR"`
|
AnsiColor string `osr:"ANSI_COLOR"`
|
||||||
Name string `osr:"NAME"`
|
Name string `osr:"NAME"`
|
||||||
Version string `osr:"VERSION"`
|
Version string `osr:"VERSION"`
|
||||||
Id string `osr:"ID"`
|
ID string `osr:"ID"`
|
||||||
IdLike string `osr:"ID_LIKE"`
|
IDLike string `osr:"ID_LIKE"`
|
||||||
PrettyName string `osr:"PRETTY_NAME"`
|
PrettyName string `osr:"PRETTY_NAME"`
|
||||||
VersionId string `osr:"VERSION_ID"`
|
VersionID string `osr:"VERSION_ID"`
|
||||||
HomeUrl string `osr:"HOME_URL"`
|
HomeURL string `osr:"HOME_URL"`
|
||||||
SupportUrl string `osr:"SUPPORT_URL"`
|
SupportURL string `osr:"SUPPORT_URL"`
|
||||||
BugReportUrl string `osr:"BUG_REPORT_URL"`
|
BugReportURL string `osr:"BUG_REPORT_URL"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func stripQuotes(val string) string {
|
func stripQuotes(val string) string {
|
||||||
|
|
|
@ -59,13 +59,13 @@ BUG_REPORT_URL="https://bugs.centos.org/"
|
||||||
AnsiColor: "",
|
AnsiColor: "",
|
||||||
Name: "Ubuntu",
|
Name: "Ubuntu",
|
||||||
Version: "14.04, Trusty Tahr",
|
Version: "14.04, Trusty Tahr",
|
||||||
Id: "ubuntu",
|
ID: "ubuntu",
|
||||||
IdLike: "debian",
|
IDLike: "debian",
|
||||||
PrettyName: "Ubuntu 14.04 LTS",
|
PrettyName: "Ubuntu 14.04 LTS",
|
||||||
VersionId: "14.04",
|
VersionID: "14.04",
|
||||||
HomeUrl: "http://www.ubuntu.com/",
|
HomeURL: "http://www.ubuntu.com/",
|
||||||
SupportUrl: "http://help.ubuntu.com/",
|
SupportURL: "http://help.ubuntu.com/",
|
||||||
BugReportUrl: "http://bugs.launchpad.net/ubuntu/",
|
BugReportURL: "http://bugs.launchpad.net/ubuntu/",
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(*osr, expectedOsr) {
|
if !reflect.DeepEqual(*osr, expectedOsr) {
|
||||||
|
@ -81,13 +81,13 @@ BUG_REPORT_URL="https://bugs.centos.org/"
|
||||||
AnsiColor: "1;32",
|
AnsiColor: "1;32",
|
||||||
Name: "Gentoo",
|
Name: "Gentoo",
|
||||||
Version: "",
|
Version: "",
|
||||||
Id: "gentoo",
|
ID: "gentoo",
|
||||||
IdLike: "",
|
IDLike: "",
|
||||||
PrettyName: "Gentoo/Linux",
|
PrettyName: "Gentoo/Linux",
|
||||||
VersionId: "",
|
VersionID: "",
|
||||||
HomeUrl: "http://www.gentoo.org/",
|
HomeURL: "http://www.gentoo.org/",
|
||||||
SupportUrl: "http://www.gentoo.org/main/en/support.xml",
|
SupportURL: "http://www.gentoo.org/main/en/support.xml",
|
||||||
BugReportUrl: "https://bugs.gentoo.org/",
|
BugReportURL: "https://bugs.gentoo.org/",
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(*osr, expectedOsr) {
|
if !reflect.DeepEqual(*osr, expectedOsr) {
|
||||||
|
@ -103,13 +103,13 @@ BUG_REPORT_URL="https://bugs.centos.org/"
|
||||||
AnsiColor: "",
|
AnsiColor: "",
|
||||||
Name: "Ubuntu",
|
Name: "Ubuntu",
|
||||||
Version: "14.04, Trusty Tahr",
|
Version: "14.04, Trusty Tahr",
|
||||||
Id: "ubuntu",
|
ID: "ubuntu",
|
||||||
IdLike: "debian",
|
IDLike: "debian",
|
||||||
PrettyName: "",
|
PrettyName: "",
|
||||||
VersionId: "14.04",
|
VersionID: "14.04",
|
||||||
HomeUrl: "http://www.ubuntu.com/",
|
HomeURL: "http://www.ubuntu.com/",
|
||||||
SupportUrl: "http://help.ubuntu.com/",
|
SupportURL: "http://help.ubuntu.com/",
|
||||||
BugReportUrl: "http://bugs.launchpad.net/ubuntu/",
|
BugReportURL: "http://bugs.launchpad.net/ubuntu/",
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(*osr, expectedOsr) {
|
if !reflect.DeepEqual(*osr, expectedOsr) {
|
||||||
|
@ -124,13 +124,13 @@ BUG_REPORT_URL="https://bugs.centos.org/"
|
||||||
expectedOsr = OsRelease{
|
expectedOsr = OsRelease{
|
||||||
Name: "CentOS Linux",
|
Name: "CentOS Linux",
|
||||||
Version: "7 (Core)",
|
Version: "7 (Core)",
|
||||||
Id: "centos",
|
ID: "centos",
|
||||||
IdLike: "rhel fedora",
|
IDLike: "rhel fedora",
|
||||||
PrettyName: "CentOS Linux 7 (Core)",
|
PrettyName: "CentOS Linux 7 (Core)",
|
||||||
AnsiColor: "0;31",
|
AnsiColor: "0;31",
|
||||||
VersionId: "7",
|
VersionID: "7",
|
||||||
HomeUrl: "https://www.centos.org/",
|
HomeURL: "https://www.centos.org/",
|
||||||
BugReportUrl: "https://bugs.centos.org/",
|
BugReportURL: "https://bugs.centos.org/",
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(*osr, expectedOsr) {
|
if !reflect.DeepEqual(*osr, expectedOsr) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ type Provisioner interface {
|
||||||
GetDockerOptionsDir() string
|
GetDockerOptionsDir() string
|
||||||
|
|
||||||
// Return the auth options used to configure remote connection for the daemon.
|
// Return the auth options used to configure remote connection for the daemon.
|
||||||
GetAuthOptions() auth.AuthOptions
|
GetAuthOptions() auth.Options
|
||||||
|
|
||||||
// Run a package action e.g. install
|
// Run a package action e.g. install
|
||||||
Package(name string, action pkgaction.PackageAction) error
|
Package(name string, action pkgaction.PackageAction) error
|
||||||
|
@ -43,7 +43,7 @@ type Provisioner interface {
|
||||||
// 3. Configure the daemon to accept connections over TLS.
|
// 3. Configure the daemon to accept connections over TLS.
|
||||||
// 4. Copy the needed certificates to the server and local config dir.
|
// 4. Copy the needed certificates to the server and local config dir.
|
||||||
// 5. Configure / activate swarm if applicable.
|
// 5. Configure / activate swarm if applicable.
|
||||||
Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error
|
Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error
|
||||||
|
|
||||||
// Perform action on a named service e.g. stop
|
// Perform action on a named service e.g. stop
|
||||||
Service(name string, action serviceaction.ServiceAction) error
|
Service(name string, action serviceaction.ServiceAction) error
|
||||||
|
@ -87,7 +87,7 @@ func DetectProvisioner(d drivers.Driver) (Provisioner, error) {
|
||||||
provisioner.SetOsReleaseInfo(osReleaseInfo)
|
provisioner.SetOsReleaseInfo(osReleaseInfo)
|
||||||
|
|
||||||
if provisioner.CompatibleWithHost() {
|
if provisioner.CompatibleWithHost() {
|
||||||
log.Debugf("found compatible host: %s", osReleaseInfo.Id)
|
log.Debugf("found compatible host: %s", osReleaseInfo.ID)
|
||||||
return provisioner, nil
|
return provisioner, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func NewRancherProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/var/lib/rancher/conf",
|
DockerOptionsDir: "/var/lib/rancher/conf",
|
||||||
DaemonOptionsFile: "/var/lib/rancher/conf/docker",
|
DaemonOptionsFile: "/var/lib/rancher/conf/docker",
|
||||||
OsReleaseId: "rancheros",
|
OsReleaseID: "rancheros",
|
||||||
Driver: d,
|
Driver: d,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ func (provisioner *RancherProvisioner) Package(name string, action pkgaction.Pac
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *RancherProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *RancherProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
provisioner.SwarmOptions = swarmOptions
|
provisioner.SwarmOptions = swarmOptions
|
||||||
provisioner.AuthOptions = authOptions
|
provisioner.AuthOptions = authOptions
|
||||||
provisioner.EngineOptions = engineOptions
|
provisioner.EngineOptions = engineOptions
|
||||||
|
|
|
@ -53,7 +53,7 @@ func NewRedHatProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner: GenericProvisioner{
|
GenericProvisioner: GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
DaemonOptionsFile: "/etc/systemd/system/docker.service",
|
||||||
OsReleaseId: "rhel",
|
OsReleaseID: "rhel",
|
||||||
Packages: []string{
|
Packages: []string{
|
||||||
"curl",
|
"curl",
|
||||||
},
|
},
|
||||||
|
@ -196,7 +196,7 @@ func (provisioner *RedHatProvisioner) dockerDaemonResponding() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *RedHatProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *RedHatProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
provisioner.SwarmOptions = swarmOptions
|
provisioner.SwarmOptions = swarmOptions
|
||||||
provisioner.AuthOptions = authOptions
|
provisioner.AuthOptions = authOptions
|
||||||
provisioner.EngineOptions = engineOptions
|
provisioner.EngineOptions = engineOptions
|
||||||
|
@ -289,7 +289,7 @@ func generateYumRepoList(provisioner Provisioner) (*bytes.Buffer, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch releaseInfo.Id {
|
switch releaseInfo.ID {
|
||||||
case "rhel", "centos":
|
case "rhel", "centos":
|
||||||
// rhel and centos both use the "centos" repo
|
// rhel and centos both use the "centos" repo
|
||||||
packageListInfo.OsRelease = "centos"
|
packageListInfo.OsRelease = "centos"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
func TestRedHatGenerateYumRepoList(t *testing.T) {
|
func TestRedHatGenerateYumRepoList(t *testing.T) {
|
||||||
info := &OsRelease{
|
info := &OsRelease{
|
||||||
Id: "rhel",
|
ID: "rhel",
|
||||||
}
|
}
|
||||||
p := NewRedHatProvisioner(nil)
|
p := NewRedHatProvisioner(nil)
|
||||||
p.SetOsReleaseInfo(info)
|
p.SetOsReleaseInfo(info)
|
||||||
|
|
|
@ -32,7 +32,7 @@ func NewOpenSUSEProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/sysconfig/docker",
|
DaemonOptionsFile: "/etc/sysconfig/docker",
|
||||||
OsReleaseId: "opensuse",
|
OsReleaseID: "opensuse",
|
||||||
Packages: []string{
|
Packages: []string{
|
||||||
"curl",
|
"curl",
|
||||||
},
|
},
|
||||||
|
@ -46,7 +46,7 @@ func NewSLEDProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/sysconfig/docker",
|
DaemonOptionsFile: "/etc/sysconfig/docker",
|
||||||
OsReleaseId: "sled",
|
OsReleaseID: "sled",
|
||||||
Packages: []string{
|
Packages: []string{
|
||||||
"curl",
|
"curl",
|
||||||
},
|
},
|
||||||
|
@ -60,7 +60,7 @@ func NewSLESProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/sysconfig/docker",
|
DaemonOptionsFile: "/etc/sysconfig/docker",
|
||||||
OsReleaseId: "sles",
|
OsReleaseID: "sles",
|
||||||
Packages: []string{
|
Packages: []string{
|
||||||
"curl",
|
"curl",
|
||||||
},
|
},
|
||||||
|
@ -129,7 +129,7 @@ func (provisioner *SUSEProvisioner) dockerDaemonResponding() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *SUSEProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *SUSEProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
provisioner.SwarmOptions = swarmOptions
|
provisioner.SwarmOptions = swarmOptions
|
||||||
provisioner.AuthOptions = authOptions
|
provisioner.AuthOptions = authOptions
|
||||||
provisioner.EngineOptions = engineOptions
|
provisioner.EngineOptions = engineOptions
|
||||||
|
|
|
@ -24,7 +24,7 @@ func NewUbuntuProvisioner(d drivers.Driver) Provisioner {
|
||||||
GenericProvisioner{
|
GenericProvisioner{
|
||||||
DockerOptionsDir: "/etc/docker",
|
DockerOptionsDir: "/etc/docker",
|
||||||
DaemonOptionsFile: "/etc/default/docker",
|
DaemonOptionsFile: "/etc/default/docker",
|
||||||
OsReleaseId: "ubuntu",
|
OsReleaseID: "ubuntu",
|
||||||
Packages: []string{
|
Packages: []string{
|
||||||
"curl",
|
"curl",
|
||||||
},
|
},
|
||||||
|
@ -114,7 +114,7 @@ func (provisioner *UbuntuProvisioner) dockerDaemonResponding() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provisioner *UbuntuProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
|
func (provisioner *UbuntuProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
|
||||||
provisioner.SwarmOptions = swarmOptions
|
provisioner.SwarmOptions = swarmOptions
|
||||||
provisioner.AuthOptions = authOptions
|
provisioner.AuthOptions = authOptions
|
||||||
provisioner.EngineOptions = engineOptions
|
provisioner.EngineOptions = engineOptions
|
||||||
|
|
|
@ -42,7 +42,7 @@ func makeDockerOptionsDir(p Provisioner) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setRemoteAuthOptions(p Provisioner) auth.AuthOptions {
|
func setRemoteAuthOptions(p Provisioner) auth.Options {
|
||||||
dockerDir := p.GetDockerOptionsDir()
|
dockerDir := p.GetDockerOptionsDir()
|
||||||
authOptions := p.GetAuthOptions()
|
authOptions := p.GetAuthOptions()
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ func TestGenerateDockerOptionsBoot2Docker(t *testing.T) {
|
||||||
Driver: &fakedriver.Driver{},
|
Driver: &fakedriver.Driver{},
|
||||||
}
|
}
|
||||||
dockerPort := 1234
|
dockerPort := 1234
|
||||||
p.AuthOptions = auth.AuthOptions{
|
p.AuthOptions = auth.Options{
|
||||||
CaCertRemotePath: "/test/ca-cert",
|
CaCertRemotePath: "/test/ca-cert",
|
||||||
ServerKeyRemotePath: "/test/server-key",
|
ServerKeyRemotePath: "/test/server-key",
|
||||||
ServerCertRemotePath: "/test/server-cert",
|
ServerCertRemotePath: "/test/server-cert",
|
||||||
|
@ -98,7 +98,7 @@ func TestMachinePortBoot2Docker(t *testing.T) {
|
||||||
}
|
}
|
||||||
dockerPort := 2376
|
dockerPort := 2376
|
||||||
bindURL := fmt.Sprintf("tcp://0.0.0.0:%d", dockerPort)
|
bindURL := fmt.Sprintf("tcp://0.0.0.0:%d", dockerPort)
|
||||||
p.AuthOptions = auth.AuthOptions{
|
p.AuthOptions = auth.Options{
|
||||||
CaCertRemotePath: "/test/ca-cert",
|
CaCertRemotePath: "/test/ca-cert",
|
||||||
ServerKeyRemotePath: "/test/server-key",
|
ServerKeyRemotePath: "/test/server-key",
|
||||||
ServerCertRemotePath: "/test/server-cert",
|
ServerCertRemotePath: "/test/server-cert",
|
||||||
|
@ -130,7 +130,7 @@ func TestMachineCustomPortBoot2Docker(t *testing.T) {
|
||||||
}
|
}
|
||||||
dockerPort := 3376
|
dockerPort := 3376
|
||||||
bindURL := fmt.Sprintf("tcp://0.0.0.0:%d", dockerPort)
|
bindURL := fmt.Sprintf("tcp://0.0.0.0:%d", dockerPort)
|
||||||
p.AuthOptions = auth.AuthOptions{
|
p.AuthOptions = auth.Options{
|
||||||
CaCertRemotePath: "/test/ca-cert",
|
CaCertRemotePath: "/test/ca-cert",
|
||||||
ServerKeyRemotePath: "/test/server-key",
|
ServerKeyRemotePath: "/test/server-key",
|
||||||
ServerCertRemotePath: "/test/server-cert",
|
ServerCertRemotePath: "/test/server-cert",
|
||||||
|
|
|
@ -35,15 +35,15 @@ type Auth struct {
|
||||||
Keys []string
|
Keys []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SSHClientType string
|
type ClientType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
maxDialAttempts = 10
|
maxDialAttempts = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
External SSHClientType = "external"
|
External ClientType = "external"
|
||||||
Native SSHClientType = "native"
|
Native ClientType = "native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -58,10 +58,10 @@ var (
|
||||||
"-o", "ControlMaster=no", // disable ssh multiplexing
|
"-o", "ControlMaster=no", // disable ssh multiplexing
|
||||||
"-o", "ControlPath=no",
|
"-o", "ControlPath=no",
|
||||||
}
|
}
|
||||||
defaultClientType SSHClientType = External
|
defaultClientType = External
|
||||||
)
|
)
|
||||||
|
|
||||||
func SetDefaultClient(clientType SSHClientType) {
|
func SetDefaultClient(clientType ClientType) {
|
||||||
// Allow over-riding of default client type, so that even if ssh binary
|
// Allow over-riding of default client type, so that even if ssh binary
|
||||||
// is found in PATH we can still use the Go native implementation if
|
// is found in PATH we can still use the Go native implementation if
|
||||||
// desired.
|
// desired.
|
||||||
|
|
|
@ -4,7 +4,7 @@ const (
|
||||||
DiscoveryServiceEndpoint = "https://discovery-stage.hub.docker.com/v1"
|
DiscoveryServiceEndpoint = "https://discovery-stage.hub.docker.com/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SwarmOptions struct {
|
type Options struct {
|
||||||
IsSwarm bool
|
IsSwarm bool
|
||||||
Address string
|
Address string
|
||||||
Discovery string
|
Discovery string
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package version
|
package version
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ApiVersion dictates which version of the libmachine API this is.
|
// APIVersion dictates which version of the libmachine API this is.
|
||||||
ApiVersion = 1
|
APIVersion = 1
|
||||||
|
|
||||||
// ConfigVersion dictates which version of the config.json format is
|
// ConfigVersion dictates which version of the config.json format is
|
||||||
// used. It needs to be bumped if there is a breaking change, and
|
// used. It needs to be bumped if there is a breaking change, and
|
||||||
|
|
|
@ -64,7 +64,7 @@ install:
|
||||||
cp $(PREFIX)/bin/docker-machine $(PREFIX)/bin/docker-machine-driver* /usr/local/bin
|
cp $(PREFIX)/bin/docker-machine $(PREFIX)/bin/docker-machine-driver* /usr/local/bin
|
||||||
|
|
||||||
clean: coverage-clean build-clean
|
clean: coverage-clean build-clean
|
||||||
test: dco fmt test-short vet
|
test: dco fmt test-short lint vet
|
||||||
validate: dco fmt vet lint test-short test-long
|
validate: dco fmt vet lint test-short test-long
|
||||||
|
|
||||||
.PHONY: .all_build .all_coverage .all_release .all_test .all_validate test build validate clean
|
.PHONY: .all_build .all_coverage .all_release .all_test .all_validate test build validate clean
|
||||||
|
|
|
@ -20,4 +20,4 @@ vet: build
|
||||||
lint:
|
lint:
|
||||||
$(if $(GOLINT), , \
|
$(if $(GOLINT), , \
|
||||||
$(error Please install golint: go get -u github.com/golang/lint/golint))
|
$(error Please install golint: go get -u github.com/golang/lint/golint))
|
||||||
@test -z "$$($(GOLINT) ./... 2>&1 | grep -v vendor/ | tee /dev/stderr)"
|
@test -z "$$($(GOLINT) ./... 2>&1 | grep -v vendor/ | grep -v drivers/ | grep -v cli/ | grep -v "should have comment" | tee /dev/stderr)"
|
||||||
|
|
Loading…
Reference in New Issue