Merge pull request #6166 from hashicorp/parallelsfixes
forcefully stop parallels vm.
This commit is contained in:
commit
0e80d98805
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,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