forcefully stop parallels vm.
also only output parallels version once.
This commit is contained in:
parent
508064d0af
commit
c920e0a20b
|
@ -131,6 +131,7 @@ func NewDriver() (Driver, error) {
|
|||
latestDriver := 11
|
||||
version, _ := drivers[strconv.Itoa(latestDriver)].Version()
|
||||
majVer, _ := strconv.Atoi(strings.SplitN(version, ".", 2)[0])
|
||||
log.Printf("Parallels version: %s", version)
|
||||
if majVer > latestDriver {
|
||||
log.Printf("Your version of Parallels Desktop for Mac is %s, Packer will use driver for version %d.", version, latestDriver)
|
||||
return drivers[strconv.Itoa(latestDriver)], nil
|
||||
|
|
|
@ -222,7 +222,7 @@ func (d *Parallels9Driver) IsRunning(name string) (bool, error) {
|
|||
|
||||
// Stop forcibly stops the VM.
|
||||
func (d *Parallels9Driver) Stop(name string) error {
|
||||
if err := d.Prlctl("stop", name); err != nil {
|
||||
if err := d.Prlctl("stop", name, "--kill"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,6 @@ func (d *Parallels9Driver) Version() (string, error) {
|
|||
}
|
||||
|
||||
version := matches[1]
|
||||
log.Printf("Parallels Desktop version: %s", version)
|
||||
return version, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ func (s *StepRun) Cleanup(state multistep.StateBag) {
|
|||
ui := state.Get("ui").(packer.Ui)
|
||||
|
||||
if running, _ := driver.IsRunning(s.vmName); running {
|
||||
if err := driver.Prlctl("stop", s.vmName); err != nil {
|
||||
if err := driver.Stop(s.vmName); err != nil {
|
||||
ui.Error(fmt.Sprintf("Error stopping VM: %s", err))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue