github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/builder/hyperv/common/step_enable_integration_service.go (about) 1 package common 2 3 import ( 4 "fmt" 5 "github.com/mitchellh/multistep" 6 "github.com/mitchellh/packer/packer" 7 ) 8 9 type StepEnableIntegrationService struct { 10 name string 11 } 12 13 func (s *StepEnableIntegrationService) Run(state multistep.StateBag) multistep.StepAction { 14 driver := state.Get("driver").(Driver) 15 ui := state.Get("ui").(packer.Ui) 16 ui.Say("Enabling Integration Service...") 17 18 vmName := state.Get("vmName").(string) 19 s.name = "Guest Service Interface" 20 21 err := driver.EnableVirtualMachineIntegrationService(vmName, s.name) 22 23 if err != nil { 24 err := fmt.Errorf("Error enabling Integration Service: %s", err) 25 state.Put("error", err) 26 ui.Error(err.Error()) 27 return multistep.ActionHalt 28 } 29 30 return multistep.ActionContinue 31 } 32 33 func (s *StepEnableIntegrationService) Cleanup(state multistep.StateBag) { 34 // do nothing 35 }