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