Handle errors when getting the checksum

pull/11132/head
Anders F Björklund 2021-04-20 08:03:02 +02:00
parent 4c20019d37
commit 13c7334b95
1 changed files with 4 additions and 2 deletions

View File

@ -142,9 +142,11 @@ func Preload(k8sVersion, containerRuntime string) error {
out.Step(style.FileDownload, "Downloading Kubernetes {{.version}} preload ...", out.V{"version": k8sVersion})
url := remoteTarballURL(k8sVersion, containerRuntime)
if checksum, err := getChecksum(k8sVersion, containerRuntime); err == nil {
url += "?checksum=" + checksum
checksum, err := getChecksum(k8sVersion, containerRuntime)
if err != nil {
return errors.Wrap(err, "getting checksum")
}
url += "?checksum=" + checksum
if err := download(url, targetPath); err != nil {
return errors.Wrapf(err, "download failed: %s", url)