Merge pull request #7575 from hashicorp/fix_7534

Step download: always copy local files
This commit is contained in:
Megan Marsh 2019-04-29 12:35:55 -07:00 committed by GitHub
commit dd7030453f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import (
"fmt"
"log"
"os"
"runtime"
"strings"
"github.com/gofrs/flock"
@ -88,6 +89,21 @@ func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multis
return multistep.ActionHalt
}
var (
getters = getter.Getters
)
func init() {
if runtime.GOOS == "windows" {
getters["file"] = &getter.FileGetter{
// always copy local files instead of symlinking to fix GH-7534. The
// longer term fix for this would be to change the go-getter so that it
// can leave the source file where it is & tell us where it is.
Copy: true,
}
}
}
func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string) (string, error) {
u, err := urlhelper.Parse(source)
if err != nil {
@ -152,6 +168,7 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string
ProgressListener: ui,
Pwd: wd,
Dir: false,
Getters: getters,
}
switch err := gc.Get(); err.(type) {