From fafdfc962f7272afe390961e804de4fe67879f85 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 10 Jun 2015 11:31:20 -0700 Subject: [PATCH] vmware/common: detect Vmware 'unknown error' and show better message --- builder/vmware/common/driver.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/builder/vmware/common/driver.go b/builder/vmware/common/driver.go index c645f40b7..ee8dbc30e 100644 --- a/builder/vmware/common/driver.go +++ b/builder/vmware/common/driver.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os/exec" + "regexp" "runtime" "strconv" "strings" @@ -135,6 +136,18 @@ func runAndLog(cmd *exec.Cmd) (string, string, error) { } err = fmt.Errorf("VMware error: %s", message) + + // If "unknown error" is in there, add some additional notes + re := regexp.MustCompile(`(?i)unknown error`) + if re.MatchString(message) { + err = fmt.Errorf( + "%s\n\n%s", err, + "Packer detected a VMware 'Unknown Error'. Unfortunately VMware\n"+ + "often has extremely vague error messages such as this and Packer\n"+ + "itself can't do much about that. Please check the vmware.log files\n"+ + "created by VMware when a VM is started (in the directory of the\n"+ + "vmx file), which often contains more detailed error information.") + } } log.Printf("stdout: %s", stdoutString)