Merge pull request #7512 from hashicorp/step_download_dont_enforce_checksum

step download: don't fail when checksum_type/checksum are empty
This commit is contained in:
Megan Marsh 2019-04-16 13:08:47 -07:00 committed by GitHub
commit 29e608e505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"},