step_download: display clearer error messages, also when the checksum is not set

Usually the builder validation should error when the checksum is empty, but for the virtualbox-ovf builder this is not validated. Which is something I didn't see when refactoring for go-getter incorporation/refactor.
This commit is contained in:
Adrien Delorme 2019-04-15 14:22:31 +02:00
parent 97f2914c6a
commit 4dc12701d3
1 changed files with 4 additions and 2 deletions

View File

@ -82,7 +82,9 @@ func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multis
errs = append(errs, err)
}
state.Put("error", fmt.Errorf("Downloading file: %v", errs))
err := fmt.Errorf("error downloading %s: %v", s.Description, errs)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
@ -104,7 +106,7 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string
q.Set("checksum", s.Checksum)
u.RawQuery = q.Encode()
} else if s.ChecksumType != "none" {
return "", fmt.Errorf("Empty checksum")
return "", fmt.Errorf("empty checksum, a checksum or a 'none' checksum type must be set")
}
targetPath := s.TargetPath