Example #1
0
func (h *Host) Upgrade() error {
	machineState, err := h.Driver.GetState()
	if err != nil {
		return err
	}

	if machineState != state.Running {
		return errMachineMustBeRunningForUpgrade
	}

	provisioner, err := provision.DetectProvisioner(h.Driver)
	if err != nil {
		crashreport.Send(err, "provision.DetectProvisioner", h.Driver.DriverName(), "Upgrade")
		return err
	}

	log.Info("Upgrading docker...")
	if err := provisioner.Package("docker", pkgaction.Upgrade); err != nil {
		crashreport.Send(err, "provisioner.Package", h.Driver.DriverName(), "Upgrade")
		return err
	}

	log.Info("Restarting docker...")
	return provisioner.Service("docker", serviceaction.Restart)
}
Example #2
0
func sendCrashReport(err error, api *Client, host *host.Host) {
	if host.DriverName == "virtualbox" {
		vboxlogPath := filepath.Join(api.GetMachinesDir(), host.Name, host.Name, "Logs", "VBox.log")
		crashreport.SendWithFile(err, "api.performCreate", host.DriverName, "Create", vboxlogPath)
	} else {
		crashreport.Send(err, "api.performCreate", host.DriverName, "Create")
	}
}