Merge pull request #7503 from hashicorp/better_empty_checksum_error_step_download
step_download: display clearer error messages, also when the checksum is not set
This commit is contained in:
commit
000dc2036f
|
@ -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
|
||||
|
|
|
@ -67,6 +67,13 @@ builder.
|
|||
- `source_path` (string) - The path to an OVF or OVA file that acts as the
|
||||
source of this build. It can also be a URL.
|
||||
|
||||
- `checksum` (string) - The checksum for the `source_path` file. The
|
||||
algorithm to use when computing the checksum can be optionally specified
|
||||
with `checksum_type`. When `checksum_type` is not set packer will guess the
|
||||
checksumming type based on `checksum` length. `checksum` can be also be a
|
||||
file or an URL, in which case `checksum_type` must be set to `file`; the
|
||||
go-getter will download it and use the first hash found.
|
||||
|
||||
### Optional:
|
||||
|
||||
- `boot_command` (array of strings) - This is an array of commands to type
|
||||
|
@ -82,9 +89,6 @@ builder.
|
|||
five seconds and one minute 30 seconds, respectively. If this isn't
|
||||
specified, the default is `10s` or 10 seconds.
|
||||
|
||||
- `checksum` (string) - The checksum for the OVA file. The type of the
|
||||
checksum is specified with `checksum_type`, documented below.
|
||||
|
||||
- `checksum_type` (string) - The type of the checksum specified in `checksum`.
|
||||
Valid values are `none`, `md5`, `sha1`, `sha256`, or `sha512`. Although the
|
||||
checksum will not be verified when `checksum_type` is set to "none", this is
|
||||
|
|
Loading…
Reference in New Issue