From cbbc8de8b25de07e03e3af1440c017a5de083838 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 23:12:37 -0700 Subject: [PATCH] builder/vmware: Properly check MD5 --- builder/vmware/step_download_iso.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builder/vmware/step_download_iso.go b/builder/vmware/step_download_iso.go index e34416281..4dbe66cb5 100644 --- a/builder/vmware/step_download_iso.go +++ b/builder/vmware/step_download_iso.go @@ -2,6 +2,7 @@ package vmware import ( "crypto/md5" + "encoding/hex" "fmt" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" @@ -105,7 +106,7 @@ func (stepDownloadISO) checkMD5(path string, expected string) error { hash := md5.New() io.Copy(hash, f) - result := strings.ToLower(string(hash.Sum(nil))) + result := strings.ToLower(hex.EncodeToString(hash.Sum(nil))) if result != expected { return fmt.Errorf("result != expected: %s != %s", result, expected) } @@ -116,7 +117,7 @@ func (stepDownloadISO) checkMD5(path string, expected string) error { func (stepDownloadISO) downloadUrl(path string, url *url.URL, progress *uint) (string, error) { if url.Scheme == "file" { // If it is just a file URL, then we already have the ISO - return path, nil + return url.Path, nil } // Otherwise, it is an HTTP URL, and we must download it.