packer-cn/builder/hyperv/common/step_enable_integration_ser...

36 lines
821 B
Go
Raw Normal View History

package common
import (
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
type StepEnableIntegrationService struct {
name string
}
func (s *StepEnableIntegrationService) Run(state multistep.StateBag) multistep.StepAction {
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packer.Ui)
ui.Say("Enabling Integration Service...")
vmName := state.Get("vmName").(string)
s.name = "Guest Service Interface"
err := driver.EnableVirtualMachineIntegrationService(vmName, s.name)
if err != nil {
err := fmt.Errorf("Error enabling Integration Service: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
return multistep.ActionContinue
}
func (s *StepEnableIntegrationService) Cleanup(state multistep.StateBag) {
// do nothing
}