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