diff --git a/post-processor/vagrant/util.go b/post-processor/vagrant/util.go index d6a1a750a..3cce14a82 100644 --- a/post-processor/vagrant/util.go +++ b/post-processor/vagrant/util.go @@ -39,6 +39,13 @@ func CopyContents(dst, src string) error { // actually a proper box. This is an expected precondition. func DirToBox(dst, dir string, ui packer.Ui, level int) error { log.Printf("Turning dir into box: %s => %s", dir, dst) + + // Make the containing directory, if it does not already exist + err := os.MkdirAll(filepath.Dir(dst), 0755) + if err != nil { + return err + } + dstF, err := os.Create(dst) if err != nil { return err