Hyper-V compiles and works, still needs identity auth.

Signed-off-by: Jeff Mendoza <jeffmendoza@live.com>
This commit is contained in:
Jeff Mendoza 2014-12-09 16:56:17 -08:00 committed by Evan Hazlett
parent 3810dacadf
commit cdf8d21873
3 changed files with 36 additions and 10 deletions

View File

@ -18,6 +18,7 @@ import (
_ "github.com/docker/machine/drivers/azure" _ "github.com/docker/machine/drivers/azure"
_ "github.com/docker/machine/drivers/digitalocean" _ "github.com/docker/machine/drivers/digitalocean"
_ "github.com/docker/machine/drivers/google" _ "github.com/docker/machine/drivers/google"
_ "github.com/docker/machine/drivers/hyperv"
_ "github.com/docker/machine/drivers/none" _ "github.com/docker/machine/drivers/none"
_ "github.com/docker/machine/drivers/openstack" _ "github.com/docker/machine/drivers/openstack"
_ "github.com/docker/machine/drivers/rackspace" _ "github.com/docker/machine/drivers/rackspace"

View File

@ -12,12 +12,12 @@ import (
"path" "path"
"time" "time"
"github.com/docker/docker/hosts/drivers"
"github.com/docker/docker/hosts/ssh"
"github.com/docker/docker/hosts/state"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
"github.com/docker/machine/drivers"
"github.com/docker/machine/ssh"
"github.com/docker/machine/state"
flag "github.com/docker/docker/pkg/mflag"
log "github.com/Sirupsen/logrus"
) )
type Driver struct { type Driver struct {
@ -359,9 +359,33 @@ func (d *Driver) GetIP() (string, error) {
return resp[0], nil return resp[0], nil
} }
func (d *Driver) GetSSHCommand(args ...string) *exec.Cmd { func (d *Driver) GetSSHCommand(args ...string) (*exec.Cmd, error) {
ip, _ := d.GetIP() ip, _ := d.GetIP()
return ssh.GetSSHCommand(ip, 22, "docker", d.sshKeyPath(), args...) return ssh.GetSSHCommand(ip, 22, "docker", d.sshKeyPath(), args...), nil
}
func (d *Driver) Upgrade() error {
log.Infof("Stopping machine...")
if err := d.Stop(); err != nil {
return err
}
isoURL, err := getLatestReleaseURL()
if err != nil {
return err
}
log.Infof("Downloading boot2docker...")
if err := downloadISO(d.storePath, "boot2docker.iso", isoURL); err != nil {
return err
}
log.Infof("Starting machine...")
if err := d.Start(); err != nil {
return err
}
return nil
} }
func (d *Driver) sshKeyPath() string { func (d *Driver) sshKeyPath() string {
@ -374,7 +398,7 @@ func (d *Driver) publicSSHKeyPath() string {
// Get the latest boot2docker release tag name (e.g. "v0.6.0"). // Get the latest boot2docker release tag name (e.g. "v0.6.0").
// FIXME: find or create some other way to get the "latest release" of boot2docker since the GitHub API has a pretty low rate limit on API requests // FIXME: find or create some other way to get the "latest release" of boot2docker since the GitHub API has a pretty low rate limit on API requests
// func getLatestReleaseURL() (string, error) { func getLatestReleaseURL() (string, error) {
// rsp, err := http.Get("https://api.github.com/repos/boot2docker/boot2docker/releases") // rsp, err := http.Get("https://api.github.com/repos/boot2docker/boot2docker/releases")
// if err != nil { // if err != nil {
// return "", err // return "", err
@ -394,7 +418,8 @@ func (d *Driver) publicSSHKeyPath() string {
// tag := t[0].TagName // tag := t[0].TagName
// url := fmt.Sprintf("https://github.com/boot2docker/boot2docker/releases/download/%s/boot2docker.iso", tag) // url := fmt.Sprintf("https://github.com/boot2docker/boot2docker/releases/download/%s/boot2docker.iso", tag)
// return url, nil // return url, nil
// } return "", nil
}
// Download boot2docker ISO image for the given tag and save it at dest. // Download boot2docker ISO image for the given tag and save it at dest.
func downloadISO(dir, file, url string) error { func downloadISO(dir, file, url string) error {

View File

@ -9,7 +9,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
var powershell string var powershell string