From 2b3ea29970dcdb45dca636c9c5c5a79a33608331 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Thu, 16 Aug 2018 18:41:44 +0200 Subject: [PATCH] show more precise error download/copy/referencing messages --- common/step_download.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/step_download.go b/common/step_download.go index 6d2b850a0..13f5e75fa 100644 --- a/common/step_download.go +++ b/common/step_download.go @@ -6,6 +6,7 @@ import ( "encoding/hex" "fmt" "log" + "strings" "time" "github.com/hashicorp/packer/helper/multistep" @@ -66,7 +67,7 @@ func (s *StepDownload) Run(_ context.Context, state multistep.StateBag) multiste } } - ui.Say(fmt.Sprintf("Downloading or copying %s", s.Description)) + ui.Say(fmt.Sprintf("Downloading, copying or inplace referencing %s", s.Description)) // First try to use any already downloaded file // If it fails, proceed to regular download logic @@ -99,6 +100,7 @@ func (s *StepDownload) Run(_ context.Context, state multistep.StateBag) multiste Checksum: checksum, UserAgent: useragent.String(), } + downloadConfigs[i] = config if match, _ := NewDownloadClient(config).VerifyChecksum(config.TargetPath); match { @@ -110,7 +112,11 @@ func (s *StepDownload) Run(_ context.Context, state multistep.StateBag) multiste if finalPath == "" { for i, url := range s.Url { - ui.Message(fmt.Sprintf("Downloading or copying: %s", url)) + if strings.HasPrefix(url, "file://") { + ui.Message(fmt.Sprintf("Copying or inplace referencing: %s", url)) + } else { + ui.Message(fmt.Sprintf("Downloading: %s", url)) + } config := downloadConfigs[i]