builder/vmware: no error if stopping already stopped [GH-1300]

This commit is contained in:
Mitchell Hashimoto 2014-09-05 10:29:35 -07:00
parent b9f82ef17e
commit cf731bf65c
2 changed files with 8 additions and 0 deletions

View File

@ -76,6 +76,8 @@ BUG FIXES:
with a zero exit code. [GH-1119]
* builder/virtualbox/iso: Append timestamp to default name for parallel
builds. [GH-1365]
* builder/vmware/all: No more error when Packer stops an already-stopped
VM. [GH-1300]
* builder/vmware/all: `ssh_host` accepts templates. [GH-1396]
* builder/vmware/all: Don't remount floppy in VMX post step. [GH-1239]
* builder/vmware/vmx: Do not re-add floppy disk files to VMX [GH-1361]

View File

@ -90,6 +90,12 @@ func (d *Fusion5Driver) Start(vmxPath string, headless bool) error {
func (d *Fusion5Driver) Stop(vmxPath string) error {
cmd := exec.Command(d.vmrunPath(), "-T", "fusion", "stop", vmxPath, "hard")
if _, _, err := runAndLog(cmd); err != nil {
// Check if the VM is running. If its not, it was already stopped
running, rerr := d.IsRunning(vmxPath)
if rerr == nil && !running {
return nil
}
return err
}