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:
commit
29e608e505
|
@ -105,8 +105,6 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string
|
||||||
q := u.Query()
|
q := u.Query()
|
||||||
q.Set("checksum", s.Checksum)
|
q.Set("checksum", s.Checksum)
|
||||||
u.RawQuery = q.Encode()
|
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
|
targetPath := s.TargetPath
|
||||||
|
|
|
@ -63,10 +63,13 @@ func TestStepDownload_Run(t *testing.T) {
|
||||||
want multistep.StepAction
|
want multistep.StepAction
|
||||||
wantFiles []string
|
wantFiles []string
|
||||||
}{
|
}{
|
||||||
{"not passing a checksum fails",
|
{"not passing a checksum passes",
|
||||||
fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}},
|
fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}},
|
||||||
multistep.ActionHalt,
|
multistep.ActionContinue,
|
||||||
nil,
|
[]string{
|
||||||
|
toSha1(abs(t, "./test-fixtures/root/another.txt")),
|
||||||
|
toSha1(abs(t, "./test-fixtures/root/another.txt")) + ".lock",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{"none checksum works, without a checksum",
|
{"none checksum works, without a checksum",
|
||||||
fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}, ChecksumType: "none"},
|
fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}, ChecksumType: "none"},
|
||||||
|
|
Loading…
Reference in New Issue