parent
dde445bd0d
commit
1ca841b499
|
@ -25,7 +25,7 @@ func TestNewArtifact(t *testing.T) {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Mkdir(filepath.Join(td, "b"), 0755); err != nil {
|
if err = os.Mkdir(filepath.Join(td, "b"), 0755); err != nil {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ func (s *StepAttachParallelsTools) Run(state multistep.StateBag) multistep.StepA
|
||||||
cdrom, err := driver.DeviceAddCDROM(vmName, parallelsToolsPath)
|
cdrom, err := driver.DeviceAddCDROM(vmName, parallelsToolsPath)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("Error attaching Parallels Tools ISO: %s", err)
|
err = fmt.Errorf("Error attaching Parallels Tools ISO: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (s *StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
ui.Say("Compacting the disk image")
|
ui.Say("Compacting the disk image")
|
||||||
diskPath, err := driver.DiskPath(vmName)
|
diskPath, err := driver.DiskPath(vmName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("Error detecting virtual disk path: %s", err)
|
err = fmt.Errorf("Error detecting virtual disk path: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (s *StepPrlctl) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
var err error
|
var err error
|
||||||
command[i], err = interpolate.Render(arg, &s.Ctx)
|
command[i], err = interpolate.Render(arg, &s.Ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("Error preparing prlctl command: %s", err)
|
err = fmt.Errorf("Error preparing prlctl command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -57,7 +57,7 @@ func (s *StepPrlctl) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
|
|
||||||
ui.Message(fmt.Sprintf("Executing: prlctl %s", strings.Join(command, " ")))
|
ui.Message(fmt.Sprintf("Executing: prlctl %s", strings.Join(command, " ")))
|
||||||
if err := driver.Prlctl(command...); err != nil {
|
if err := driver.Prlctl(command...); err != nil {
|
||||||
err := fmt.Errorf("Error executing command: %s", err)
|
err = fmt.Errorf("Error executing command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
ui.Say("Starting the virtual machine...")
|
ui.Say("Starting the virtual machine...")
|
||||||
command := []string{"start", vmName}
|
command := []string{"start", vmName}
|
||||||
if err := driver.Prlctl(command...); err != nil {
|
if err := driver.Prlctl(command...); err != nil {
|
||||||
err := fmt.Errorf("Error starting VM: %s", err)
|
err = fmt.Errorf("Error starting VM: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
log.Printf("Executing shutdown command: %s", s.Command)
|
log.Printf("Executing shutdown command: %s", s.Command)
|
||||||
cmd := &packer.RemoteCmd{Command: s.Command}
|
cmd := &packer.RemoteCmd{Command: s.Command}
|
||||||
if err := cmd.StartWithUi(comm, ui); err != nil {
|
if err := cmd.StartWithUi(comm, ui); err != nil {
|
||||||
err := fmt.Errorf("Failed to send shutdown command: %s", err)
|
err = fmt.Errorf("Failed to send shutdown command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -65,7 +65,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
} else {
|
} else {
|
||||||
ui.Say("Halting the virtual machine...")
|
ui.Say("Halting the virtual machine...")
|
||||||
if err := driver.Stop(vmName); err != nil {
|
if err := driver.Stop(vmName); err != nil {
|
||||||
err := fmt.Errorf("Error stopping VM: %s", err)
|
err = fmt.Errorf("Error stopping VM: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
|
@ -58,7 +58,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
||||||
|
|
||||||
ip, err := ipFinder.HostIP()
|
ip, err := ipFinder.HostIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("Error detecting host IP: %s", err)
|
err = fmt.Errorf("Error detecting host IP: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -78,7 +78,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
||||||
for i, command := range s.BootCommand {
|
for i, command := range s.BootCommand {
|
||||||
command, err := interpolate.Render(command, &s.Ctx)
|
command, err := interpolate.Render(command, &s.Ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("Error preparing boot command: %s", err)
|
err = fmt.Errorf("Error preparing boot command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -88,7 +88,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
||||||
for _, code := range scancodes(command) {
|
for _, code := range scancodes(command) {
|
||||||
if code == "wait" {
|
if code == "wait" {
|
||||||
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
||||||
err := fmt.Errorf("Error sending boot command: %s", err)
|
err = fmt.Errorf("Error sending boot command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -100,7 +100,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
||||||
|
|
||||||
if code == "wait5" {
|
if code == "wait5" {
|
||||||
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
||||||
err := fmt.Errorf("Error sending boot command: %s", err)
|
err = fmt.Errorf("Error sending boot command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -112,7 +112,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
||||||
|
|
||||||
if code == "wait10" {
|
if code == "wait10" {
|
||||||
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
||||||
err := fmt.Errorf("Error sending boot command: %s", err)
|
err = fmt.Errorf("Error sending boot command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -136,7 +136,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
||||||
|
|
||||||
log.Printf("Sending scancodes: %#v", codes)
|
log.Printf("Sending scancodes: %#v", codes)
|
||||||
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil {
|
||||||
err := fmt.Errorf("Error sending boot command: %s", err)
|
err = fmt.Errorf("Error sending boot command: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepA
|
||||||
|
|
||||||
s.ParallelsToolsGuestPath, err = interpolate.Render(s.ParallelsToolsGuestPath, &s.Ctx)
|
s.ParallelsToolsGuestPath, err = interpolate.Render(s.ParallelsToolsGuestPath, &s.Ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("Error preparing Parallels Tools path: %s", err)
|
err = fmt.Errorf("Error preparing Parallels Tools path: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -65,7 +65,7 @@ func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepA
|
||||||
ui.Say(fmt.Sprintf("Uploading Parallels Tools for '%s' to path: '%s'",
|
ui.Say(fmt.Sprintf("Uploading Parallels Tools for '%s' to path: '%s'",
|
||||||
s.ParallelsToolsFlavor, s.ParallelsToolsGuestPath))
|
s.ParallelsToolsFlavor, s.ParallelsToolsGuestPath))
|
||||||
if err := comm.Upload(s.ParallelsToolsGuestPath, f, nil); err != nil {
|
if err := comm.Upload(s.ParallelsToolsGuestPath, f, nil); err != nil {
|
||||||
err := fmt.Errorf("Error uploading Parallels Tools: %s", err)
|
err = fmt.Errorf("Error uploading Parallels Tools: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
Loading…
Reference in New Issue