Add support for VMware Fusion 7 Pro [GH-1478]
This commit is contained in:
parent
f36b20ca28
commit
a7aa20c8c7
|
@ -158,7 +158,7 @@ func normalizeVersion(version string) (string, error) {
|
||||||
return fmt.Sprintf("%02d", i), nil
|
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)
|
found, err := normalizeVersion(versionFound)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -171,7 +171,7 @@ func compareVersions(versionFound string, versionWanted string) error {
|
||||||
|
|
||||||
if found < wanted {
|
if found < wanted {
|
||||||
return fmt.Errorf(
|
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
|
return nil
|
||||||
|
|
|
@ -11,7 +11,9 @@ import (
|
||||||
"strings"
|
"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 {
|
type Fusion6Driver struct {
|
||||||
Fusion5Driver
|
Fusion5Driver
|
||||||
}
|
}
|
||||||
|
@ -25,7 +27,7 @@ func (d *Fusion6Driver) Clone(dst, src string) error {
|
||||||
if strings.Contains(err.Error(), "parameters was invalid") {
|
if strings.Contains(err.Error(), "parameters was invalid") {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"Clone is not supported with your version of Fusion. Packer " +
|
"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
|
return err
|
||||||
|
@ -56,7 +58,7 @@ func (d *Fusion6Driver) Verify() error {
|
||||||
return err
|
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())
|
matches := versionRe.FindStringSubmatch(stderr.String())
|
||||||
if matches == nil {
|
if matches == nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -64,10 +66,5 @@ func (d *Fusion6Driver) Verify() error {
|
||||||
}
|
}
|
||||||
log.Printf("Detected VMware version: %s", matches[1])
|
log.Printf("Detected VMware version: %s", matches[1])
|
||||||
|
|
||||||
if !strings.HasPrefix(matches[1], "6.") {
|
return compareVersions(matches[1], VMWARE_FUSION_VERSION, "Fusion Professional")
|
||||||
return fmt.Errorf(
|
|
||||||
"Fusion 6 not detected. Got version: %s", matches[1])
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,5 @@ func playerVerifyVersion(version string) error {
|
||||||
}
|
}
|
||||||
log.Printf("Detected VMware Player version: %s", matches[1])
|
log.Printf("Detected VMware Player version: %s", matches[1])
|
||||||
|
|
||||||
return compareVersions(matches[1], version)
|
return compareVersions(matches[1], version, "Player")
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,5 +64,5 @@ func playerVerifyVersion(version string) error {
|
||||||
}
|
}
|
||||||
log.Printf("Detected VMWare Player version: %s", matches[1])
|
log.Printf("Detected VMWare Player version: %s", matches[1])
|
||||||
|
|
||||||
return compareVersions(matches[1], version)
|
return compareVersions(matches[1], version, "Player")
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,5 @@ func workstationVerifyVersion(version string) error {
|
||||||
}
|
}
|
||||||
log.Printf("Detected VMware WS version: %s", matches[1])
|
log.Printf("Detected VMware WS version: %s", matches[1])
|
||||||
|
|
||||||
return compareVersions(matches[1], version)
|
return compareVersions(matches[1], version, "Workstation")
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,5 +75,5 @@ func workstationVerifyVersion(version string) error {
|
||||||
}
|
}
|
||||||
log.Printf("Detected VMware WS version: %s", matches[1])
|
log.Printf("Detected VMware WS version: %s", matches[1])
|
||||||
|
|
||||||
return compareVersions(matches[1], version)
|
return compareVersions(matches[1], version, "Workstation")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue