Example #1
0
func (h *Host) getProvisioner() (provision.Provisioner, error) {
	provisioner, err := provision.DetectProvisioner(h.Driver)
	if err != nil {
		return nil, fmt.Errorf("Error getting provisioner: %s", err)
	}

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

	if machineState != state.Running {
		log.Fatal(errMachineMustBeRunningForUpgrade)
	}

	provisioner, err := provision.DetectProvisioner(h.Driver)
	if err != nil {
		return err
	}

	if err := provisioner.Package("docker", pkgaction.Upgrade); err != nil {
		return err
	}

	if err := provisioner.Service("docker", pkgaction.Restart); err != nil {
		return err
	}
	return nil
}