github.com/rothwerx/packer@v0.9.0/builder/parallels/iso/step_set_boot_order.go (about) 1 package iso 2 3 import ( 4 "fmt" 5 "github.com/mitchellh/multistep" 6 parallelscommon "github.com/mitchellh/packer/builder/parallels/common" 7 "github.com/mitchellh/packer/packer" 8 ) 9 10 // This step sets the device boot order for the virtual machine. 11 // 12 // Uses: 13 // driver Driver 14 // ui packer.Ui 15 // vmName string 16 // 17 // Produces: 18 type stepSetBootOrder struct{} 19 20 func (s *stepSetBootOrder) Run(state multistep.StateBag) multistep.StepAction { 21 driver := state.Get("driver").(parallelscommon.Driver) 22 ui := state.Get("ui").(packer.Ui) 23 vmName := state.Get("vmName").(string) 24 25 // Set new boot order 26 ui.Say("Setting the boot order...") 27 command := []string{ 28 "set", vmName, 29 "--device-bootorder", fmt.Sprintf("hdd0 cdrom0 net0"), 30 } 31 32 if err := driver.Prlctl(command...); err != nil { 33 err := fmt.Errorf("Error setting the boot order: %s", err) 34 state.Put("error", err) 35 ui.Error(err.Error()) 36 return multistep.ActionHalt 37 } 38 39 return multistep.ActionContinue 40 } 41 42 func (s *stepSetBootOrder) Cleanup(state multistep.StateBag) {}