builder/virtualbox,vmware: retry removing output dir if fails
This commit is contained in:
parent
8ac03e4898
commit
558027465a
|
@ -17,6 +17,8 @@ BUG FIXES:
|
|||
|
||||
* builder/virtualbox,vmware: relative paths work properly as URL
|
||||
configurations. [GH-215]
|
||||
* builder/virtualbox,vmware: fix race condition in deleting the output
|
||||
directory on Windows by retrying.
|
||||
|
||||
## 0.2.1 (July 26, 2013)
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@ package virtualbox
|
|||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type stepPrepareOutputDir struct{}
|
||||
|
@ -34,6 +36,14 @@ func (stepPrepareOutputDir) Cleanup(state map[string]interface{}) {
|
|||
ui := state["ui"].(packer.Ui)
|
||||
|
||||
ui.Say("Deleting output directory...")
|
||||
os.RemoveAll(config.OutputDir)
|
||||
for i := 0; i < 5; i++ {
|
||||
err := os.RemoveAll(config.OutputDir)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
log.Printf("Error removing output dir: %s", err)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package vmware
|
|||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type stepPrepareOutputDir struct{}
|
||||
|
@ -34,6 +36,15 @@ func (stepPrepareOutputDir) Cleanup(state map[string]interface{}) {
|
|||
ui := state["ui"].(packer.Ui)
|
||||
|
||||
ui.Say("Deleting output directory...")
|
||||
os.RemoveAll(config.OutputDir)
|
||||
|
||||
for i := 0; i < 5; i++ {
|
||||
err := os.RemoveAll(config.OutputDir)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
log.Printf("Error removing output dir: %s", err)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue