step download: don't fail when checksum_type is not set

This commit is contained in:
Adrien Delorme 2019-04-16 17:53:32 +02:00
parent 45af9f0cbc
commit 5f0259fe89
2 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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"},