show more precise error download/copy/referencing messages

pull/6593/head
Adrien Delorme 8 years ago
parent fae3db4e58
commit 2b3ea29970

@ -6,6 +6,7 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"log" "log"
"strings"
"time" "time"
"github.com/hashicorp/packer/helper/multistep" "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 // First try to use any already downloaded file
// If it fails, proceed to regular download logic // If it fails, proceed to regular download logic
@ -99,6 +100,7 @@ func (s *StepDownload) Run(_ context.Context, state multistep.StateBag) multiste
Checksum: checksum, Checksum: checksum,
UserAgent: useragent.String(), UserAgent: useragent.String(),
} }
downloadConfigs[i] = config downloadConfigs[i] = config
if match, _ := NewDownloadClient(config).VerifyChecksum(config.TargetPath); match { if match, _ := NewDownloadClient(config).VerifyChecksum(config.TargetPath); match {
@ -110,7 +112,11 @@ func (s *StepDownload) Run(_ context.Context, state multistep.StateBag) multiste
if finalPath == "" { if finalPath == "" {
for i, url := range s.Url { 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] config := downloadConfigs[i]

Loading…
Cancel
Save