Browse Source

Update boot2docker download mechanism to the latest interface

- This fixes "GetLatestBoot2DockerReleaseURL is undefined"
- The download mechanism should cache in PreCreateCheck to align with
  other drivers

Signed-off-by: Robert Breker <robert.breker@citrix.com>
getsshkeypath_pr
Robert Breker 9 years ago
parent
commit
2d685795b6
  1. 22
      xenserver.go

22
xenserver.go

@ -288,6 +288,13 @@ func (d *Driver) GetState() (state.State, error) {
} }
func (d *Driver) PreCreateCheck() error { func (d *Driver) PreCreateCheck() error {
// Downloading boot2docker to cache should be done here to make sure
// that a download failure will not leave a machine half created.
b2dutils := mcnutils.NewB2dUtils(d.StorePath)
if err := b2dutils.UpdateISOCache(d.Boot2DockerURL); err != nil {
return err
}
return nil return nil
} }
@ -296,21 +303,8 @@ func (d *Driver) Create() error {
d.setMachineNameIfNotSet() d.setMachineNameIfNotSet()
// Download boot2docker ISO from Internet
var isoURL string
b2dutils := mcnutils.NewB2dUtils(d.StorePath) b2dutils := mcnutils.NewB2dUtils(d.StorePath)
if err := b2dutils.CopyIsoToMachineDir(d.Boot2DockerURL, d.MachineName); err != nil {
if d.Boot2DockerURL != "" {
isoURL = d.Boot2DockerURL
} else {
isoURL, err = b2dutils.GetLatestBoot2DockerReleaseURL("")
if err != nil {
log.Errorf("Unable to check for the latest release: %s", err)
return err
}
}
log.Infof("Downloading %s from %s...", isoFilename, isoURL)
if err := b2dutils.DownloadISO(d.StorePath, isoFilename, isoURL); err != nil {
return err return err
} }

Loading…
Cancel
Save