예제 #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
}
예제 #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
}