Add support for VMware Fusion 7 Pro [GH-1478]

This commit is contained in:
Ross Smith II 2014-09-10 10:14:50 -07:00
parent f36b20ca28
commit a7aa20c8c7
6 changed files with 12 additions and 15 deletions

View File

@ -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

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}