Step download: always copy local files

instead of symlinking to fix #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.

We will do this when the right time comes.
This commit is contained in:
Adrien Delorme 2019-04-26 10:34:01 +02:00
parent 6b081cc41c
commit 200e26ea85
1 changed files with 14 additions and 0 deletions

View File

@ -88,6 +88,19 @@ func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multis
return multistep.ActionHalt return multistep.ActionHalt
} }
var (
getters = getter.Getters
)
func init() {
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) { func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string) (string, error) {
u, err := urlhelper.Parse(source) u, err := urlhelper.Parse(source)
if err != nil { if err != nil {
@ -152,6 +165,7 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string
ProgressListener: ui, ProgressListener: ui,
Pwd: wd, Pwd: wd,
Dir: false, Dir: false,
Getters: getters,
} }
switch err := gc.Get(); err.(type) { switch err := gc.Get(); err.(type) {