packer-cn/builder/vmware/common/driver_player6.go
Ali Rizvi-Santiago 75fbfa0763 Replaced a hacky type assertion in the VMware builder with a call to Driver.GetVmwareDriver() that returns the driver-specific structure for ip and addressing information. Also implemented the addressing functions for the ESXi driver interface.
This fixes an issue where a driver might not have defined a VmwareDriver by forcing a developer to implement it via the standard Driver interface.
2018-02-02 19:18:48 -06:00

42 lines
740 B
Go

package common
import (
"os/exec"
)
const VMWARE_PLAYER_VERSION = "6"
// Player6Driver is a driver that can run VMware Player 6
// installations.
type Player6Driver struct {
Player5Driver
}
func (d *Player6Driver) Clone(dst, src string) error {
// TODO(rasa) check if running player+, not just player
cmd := exec.Command(d.Player5Driver.VmrunPath,
"-T", "ws",
"clone", src, dst,
"full")
if _, _, err := runAndLog(cmd); err != nil {
return err
}
return nil
}
func (d *Player6Driver) Verify() error {
if err := d.Player5Driver.Verify(); err != nil {
return err
}
return playerVerifyVersion(VMWARE_PLAYER_VERSION)
}
func (d *Player6Driver) GetVmwareDriver() VmwareDriver {
return d.Player5Driver.VmwareDriver
}