diff --git a/builder/vmware/common/driver.go b/builder/vmware/common/driver.go index 833cbbbbc..c645f40b7 100644 --- a/builder/vmware/common/driver.go +++ b/builder/vmware/common/driver.go @@ -158,7 +158,7 @@ func normalizeVersion(version string) (string, error) { return fmt.Sprintf("%02d", i), nil } -func compareVersions(versionFound string, versionWanted string) error { +func compareVersions(versionFound string, versionWanted string, product string) error { found, err := normalizeVersion(versionFound) if err != nil { return err @@ -171,7 +171,7 @@ func compareVersions(versionFound string, versionWanted string) error { if found < wanted { return fmt.Errorf( - "VMware WS version %s, or greater, is required. Found version: %s", versionWanted, versionFound) + "VMware %s version %s, or greater, is required. Found version: %s", product, versionWanted, versionFound) } return nil diff --git a/builder/vmware/common/driver_fusion6.go b/builder/vmware/common/driver_fusion6.go index 09f308e70..ae4d63b9a 100644 --- a/builder/vmware/common/driver_fusion6.go +++ b/builder/vmware/common/driver_fusion6.go @@ -11,7 +11,9 @@ import ( "strings" ) -// Fusion6Driver is a driver that can run VMware Fusion 5. +const VMWARE_FUSION_VERSION = "6" + +// Fusion6Driver is a driver that can run VMware Fusion 6. type Fusion6Driver struct { Fusion5Driver } @@ -25,7 +27,7 @@ func (d *Fusion6Driver) Clone(dst, src string) error { if strings.Contains(err.Error(), "parameters was invalid") { return fmt.Errorf( "Clone is not supported with your version of Fusion. Packer " + - "only works with Fusion 6 Professional. Please verify your version.") + "only works with Fusion %s Professional or above. Please verify your version.", VMWARE_FUSION_VERSION) } return err @@ -56,7 +58,7 @@ func (d *Fusion6Driver) Verify() error { return err } - versionRe := regexp.MustCompile(`(?i)VMware [a-z0-9-]+ (\d+\.\d+\.\d+)\s`) + versionRe := regexp.MustCompile(`(?i)VMware [a-z0-9-]+ (\d+)\.`) matches := versionRe.FindStringSubmatch(stderr.String()) if matches == nil { return fmt.Errorf( @@ -64,10 +66,5 @@ func (d *Fusion6Driver) Verify() error { } log.Printf("Detected VMware version: %s", matches[1]) - if !strings.HasPrefix(matches[1], "6.") { - return fmt.Errorf( - "Fusion 6 not detected. Got version: %s", matches[1]) - } - - return nil + return compareVersions(matches[1], VMWARE_FUSION_VERSION, "Fusion Professional") } diff --git a/builder/vmware/common/driver_player6_windows.go b/builder/vmware/common/driver_player6_windows.go index 78fd06618..91c1f7a19 100644 --- a/builder/vmware/common/driver_player6_windows.go +++ b/builder/vmware/common/driver_player6_windows.go @@ -31,5 +31,5 @@ func playerVerifyVersion(version string) error { } log.Printf("Detected VMware Player version: %s", matches[1]) - return compareVersions(matches[1], version) + return compareVersions(matches[1], version, "Player") } diff --git a/builder/vmware/common/driver_player_unix.go b/builder/vmware/common/driver_player_unix.go index 7f23c4453..0c2cc8635 100644 --- a/builder/vmware/common/driver_player_unix.go +++ b/builder/vmware/common/driver_player_unix.go @@ -64,5 +64,5 @@ func playerVerifyVersion(version string) error { } log.Printf("Detected VMWare Player version: %s", matches[1]) - return compareVersions(matches[1], version) + return compareVersions(matches[1], version, "Player") } diff --git a/builder/vmware/common/driver_workstation10_windows.go b/builder/vmware/common/driver_workstation10_windows.go index 11721e950..dd7028056 100644 --- a/builder/vmware/common/driver_workstation10_windows.go +++ b/builder/vmware/common/driver_workstation10_windows.go @@ -31,5 +31,5 @@ func workstationVerifyVersion(version string) error { } log.Printf("Detected VMware WS version: %s", matches[1]) - return compareVersions(matches[1], version) + return compareVersions(matches[1], version, "Workstation") } diff --git a/builder/vmware/common/driver_workstation_unix.go b/builder/vmware/common/driver_workstation_unix.go index 74fd3ba0a..bf6ef53da 100644 --- a/builder/vmware/common/driver_workstation_unix.go +++ b/builder/vmware/common/driver_workstation_unix.go @@ -75,5 +75,5 @@ func workstationVerifyVersion(version string) error { } log.Printf("Detected VMware WS version: %s", matches[1]) - return compareVersions(matches[1], version) + return compareVersions(matches[1], version, "Workstation") }