tls fixes to support swarm; test updates; improved provisioning logging

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2015-01-24 21:03:53 -05:00
parent a73deea5d0
commit 557d03a849
9 changed files with 33 additions and 14 deletions

View File

@ -273,6 +273,8 @@ func (d *Driver) Create() error {
return err
}
log.Info("Configuring Machine...")
log.Debug("Settings tags for instance")
tags := map[string]string{
"Name": d.MachineName,
@ -594,6 +596,8 @@ func (d *Driver) configureSecurityGroup(groupName string) error {
d.SecurityGroupId = securityGroup.GroupId
// configure swarm permission if needed
log.Debugf("configuring security group authorization for %s", ipRange)
perms := configureSecurityGroupPermissions(securityGroup)

View File

@ -11,7 +11,6 @@ import (
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/digitalocean/godo"
// "github.com/docker/docker/utils"
"github.com/docker/machine/drivers"
"github.com/docker/machine/ssh"
"github.com/docker/machine/state"
@ -156,6 +155,8 @@ func (d *Driver) Create() error {
return err
}
log.Info("Configuring Machine...")
log.Debugf("Setting hostname: %s", d.MachineName)
cmd, err := d.GetSSHCommand(fmt.Sprintf(
"echo \"127.0.0.1 %s\" | sudo tee -a /etc/hosts && sudo hostname %s && echo \"%s\" | sudo tee /etc/hostname",

View File

@ -196,6 +196,8 @@ func (c *ComputeUtil) createInstance(d *Driver) error {
return err
}
log.Info("Configuring Machine...")
log.Debugf("Setting hostname: %s", d.MachineName)
cmd, err := d.GetSSHCommand(fmt.Sprintf(
"echo \"127.0.0.1 %s\" | sudo tee -a /etc/hosts && sudo hostname %s && echo \"%s\" | sudo tee /etc/hostname",

View File

@ -62,7 +62,7 @@ func (c *GenericClient) CreateInstance(d *Driver) (string, error) {
log.WithFields(log.Fields{
"Name": d.MachineName,
}).Info("Creating server...")
}).Info("Creating machine...")
server, err := servers.Create(c.Compute, keypairs.CreateOptsExt{
serverOpts,

View File

@ -390,6 +390,8 @@ func (d *Driver) Create() error {
return err
}
log.Info("Configuring Machine...")
log.Debugf("Setting hostname: %s", d.MachineName)
cmd, err := d.GetSSHCommand(fmt.Sprintf(
"echo \"127.0.0.1 %s\" | sudo tee -a /etc/hosts && sudo hostname %s && echo \"%s\" | sudo tee /etc/hostname",

View File

@ -161,10 +161,7 @@ func (h *Host) ConfigureSwarm(discovery string, master bool, host string, addr s
if err := cmd.Run(); err != nil {
return err
}
// TODO:
// - configure swarm to start / autostart
// - configure node to join cluster
// - configure node to run with IP of machine and URL to Docker
return nil
}

View File

@ -69,7 +69,7 @@ func (s *Store) Create(name string, driverName string, flags drivers.DriverOptio
}
if flags.Bool("swarm") {
log.Info("Configuring Swarm")
log.Info("Configuring Swarm...")
discovery := flags.String("swarm-discovery")
master := flags.Bool("swarm-master")

View File

@ -36,7 +36,9 @@ func TestStoreCreate(t *testing.T) {
flags := &DriverOptionsMock{
Data: map[string]interface{}{
"url": "unix:///var/run/docker.sock",
"url": "unix:///var/run/docker.sock",
"swarm-master-ip": "",
"swarm": false,
},
}
@ -62,7 +64,9 @@ func TestStoreRemove(t *testing.T) {
flags := &DriverOptionsMock{
Data: map[string]interface{}{
"url": "unix:///var/run/docker.sock",
"url": "unix:///var/run/docker.sock",
"swarm-master-ip": "",
"swarm": false,
},
}
@ -91,7 +95,9 @@ func TestStoreList(t *testing.T) {
flags := &DriverOptionsMock{
Data: map[string]interface{}{
"url": "unix:///var/run/docker.sock",
"url": "unix:///var/run/docker.sock",
"swarm-master-ip": "",
"swarm": false,
},
}
@ -116,7 +122,9 @@ func TestStoreExists(t *testing.T) {
flags := &DriverOptionsMock{
Data: map[string]interface{}{
"url": "unix:///var/run/docker.sock",
"url": "unix:///var/run/docker.sock",
"swarm-master-ip": "",
"swarm": false,
},
}
@ -146,7 +154,9 @@ func TestStoreLoad(t *testing.T) {
expectedURL := "unix:///foo/baz"
flags := &DriverOptionsMock{
Data: map[string]interface{}{
"url": expectedURL,
"url": expectedURL,
"swarm-master-ip": "",
"swarm": false,
},
}
@ -177,7 +187,9 @@ func TestStoreGetSetActive(t *testing.T) {
flags := &DriverOptionsMock{
Data: map[string]interface{}{
"url": "unix:///var/run/docker.sock",
"url": "unix:///var/run/docker.sock",
"swarm-master-ip": "",
"swarm": false,
},
}

View File

@ -93,9 +93,10 @@ func GenerateCert(hosts []string, certFile, keyFile, caFile, caKeyFile, org stri
}
// client
if len(hosts) == 1 && hosts[0] == "" {
template.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}
template.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}
template.KeyUsage = x509.KeyUsageDigitalSignature
} else { // server
template.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}
for _, h := range hosts {
if ip := net.ParseIP(h); ip != nil {
template.IPAddresses = append(template.IPAddresses, ip)