From 5f0259fe895cff574045e62aba388058e82aa228 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 16 Apr 2019 17:53:32 +0200 Subject: [PATCH] step download: don't fail when checksum_type is not set --- common/step_download.go | 2 -- common/step_download_test.go | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/step_download.go b/common/step_download.go index 39d82964d..4351e29c2 100644 --- a/common/step_download.go +++ b/common/step_download.go @@ -105,8 +105,6 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string q := u.Query() q.Set("checksum", s.Checksum) u.RawQuery = q.Encode() - } else if s.ChecksumType != "none" { - return "", fmt.Errorf("empty checksum, a checksum or a 'none' checksum type must be set") } targetPath := s.TargetPath diff --git a/common/step_download_test.go b/common/step_download_test.go index c824bd9dc..8a8df9960 100644 --- a/common/step_download_test.go +++ b/common/step_download_test.go @@ -63,10 +63,13 @@ func TestStepDownload_Run(t *testing.T) { want multistep.StepAction wantFiles []string }{ - {"not passing a checksum fails", + {"not passing a checksum passes", fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}}, - multistep.ActionHalt, - nil, + multistep.ActionContinue, + []string{ + toSha1(abs(t, "./test-fixtures/root/another.txt")), + toSha1(abs(t, "./test-fixtures/root/another.txt")) + ".lock", + }, }, {"none checksum works, without a checksum", fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}, ChecksumType: "none"},