tls support for vcloud air

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2015-01-14 23:18:55 -05:00
parent f4cf4ce801
commit 35e0351889
2 changed files with 20 additions and 66 deletions

View File

@ -25,7 +25,6 @@ import (
_ "github.com/docker/machine/drivers/vmwarefusion" _ "github.com/docker/machine/drivers/vmwarefusion"
_ "github.com/docker/machine/drivers/vmwarevcloudair" _ "github.com/docker/machine/drivers/vmwarevcloudair"
_ "github.com/docker/machine/drivers/vmwarevsphere" _ "github.com/docker/machine/drivers/vmwarevsphere"
//_ "github.com/docker/machine/drivers/vmwarevcloudair" //_ "github.com/docker/machine/drivers/vmwarevcloudair"
//_ "github.com/docker/machine/drivers/vmwarevsphere" //_ "github.com/docker/machine/drivers/vmwarevsphere"
"github.com/docker/machine/state" "github.com/docker/machine/state"

View File

@ -10,7 +10,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path" "path"
"strconv"
"strings" "strings"
"github.com/vmware/govcloudair" "github.com/vmware/govcloudair"
@ -28,21 +27,23 @@ const (
) )
type Driver struct { type Driver struct {
UserName string UserName string
UserPassword string UserPassword string
ComputeID string ComputeID string
VDCID string VDCID string
OrgVDCNet string OrgVDCNet string
EdgeGateway string EdgeGateway string
PublicIP string PublicIP string
Catalog string Catalog string
CatalogItem string CatalogItem string
MachineName string MachineName string
SSHPort int SSHPort int
DockerPort int DockerPort int
Provision bool Provision bool
CPUCount int CPUCount int
MemorySize int MemorySize int
CaCertPath string
PrivateKeyPath string
VAppID string VAppID string
storePath string storePath string
@ -159,8 +160,8 @@ func GetCreateFlags() []cli.Flag {
} }
} }
func NewDriver(machineName string, storePath string) (drivers.Driver, error) { func NewDriver(machineName string, storePath string, caCert string, privateKey string) (drivers.Driver, error) {
driver := &Driver{MachineName: machineName, storePath: storePath} driver := &Driver{MachineName: machineName, storePath: storePath, CaCertPath: caCert, PrivateKeyPath: privateKey}
return driver, nil return driver, nil
} }
@ -229,7 +230,7 @@ func (d *Driver) GetState() (state.State, error) {
return state.Error, err return state.Error, err
} }
log.Infof("Connecting to vCloud Air to fetch vApp Status...") log.Debug("Connecting to vCloud Air to fetch vApp Status...")
// Authenticate to vCloud Air // Authenticate to vCloud Air
v, err := p.Authenticate(d.UserName, d.UserPassword, d.ComputeID, d.VDCID) v, err := p.Authenticate(d.UserName, d.UserPassword, d.ComputeID, d.VDCID)
if err != nil { if err != nil {
@ -426,52 +427,6 @@ func (d *Driver) Create() error {
return err return err
} }
log.Debugf("Stopping Docker")
cmd, err = d.GetSSHCommand("stop docker")
if err != nil {
return err
}
if err := cmd.Run(); err != nil {
return err
}
log.Debugf("Replacing docker binary with a version that supports identity authentication")
cmd, err = d.GetSSHCommand("curl -sS https://bfirsh.s3.amazonaws.com/docker/docker-1.3.1-dev-identity-auth > /usr/bin/docker")
if err != nil {
return err
}
if err := cmd.Run(); err != nil {
return err
}
dockerListen := "echo 'export DOCKER_OPTS=\"--auth=identity --host=tcp://0.0.0.0:" + strconv.Itoa(d.DockerPort) + "\"' >> /etc/default/docker"
log.Infof("Updating /etc/default/docker to listen on all interfaces...")
cmd, err = d.GetSSHCommand(dockerListen)
if err != nil {
return err
}
if err = cmd.Run(); err != nil {
return err
}
log.Debugf("Adding key to authorized-keys.d...")
if err := drivers.AddPublicKeyToAuthorizedHosts(d, "/.docker/authorized-keys.d"); err != nil {
return err
}
cmd, err = d.GetSSHCommand("start docker")
if err != nil {
return err
}
if err := cmd.Run(); err != nil {
return err
}
} }
log.Debugf("Disconnecting from vCloud Air...") log.Debugf("Disconnecting from vCloud Air...")