Commit 4576093c authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

fmt

parent 9a622691
...@@ -75,11 +75,11 @@ func NewDriver(dconfig *DriverConfig, config *SSHConfig) (Driver, error) { ...@@ -75,11 +75,11 @@ func NewDriver(dconfig *DriverConfig, config *SSHConfig) (Driver, error) {
} }
case "linux": case "linux":
drivers = []Driver{ drivers = []Driver{
&Workstation10Driver { &Workstation10Driver{
Workstation9Driver: Workstation9Driver { Workstation9Driver: Workstation9Driver{
SSHConfig: config, SSHConfig: config,
}, },
}, },
&Workstation9Driver{ &Workstation9Driver{
SSHConfig: config, SSHConfig: config,
}, },
......
package common package common
import ( import (
"os/exec" "bytes"
"bytes" "fmt"
"regexp" "log"
"fmt" "os/exec"
"log" "regexp"
"strings" "runtime"
"runtime" "strings"
) )
// Workstation10Driver is a driver that can run VMware Workstation 10 // Workstation10Driver is a driver that can run VMware Workstation 10
// installations. Current only tested for UNIX // installations. Current only tested for UNIX
type Workstation10Driver struct { type Workstation10Driver struct {
Workstation9Driver Workstation9Driver
} }
func (d *Workstation10Driver) Clone(dst, src string) error { func (d *Workstation10Driver) Clone(dst, src string) error {
cmd := exec.Command(d.Workstation9Driver.VmrunPath, cmd := exec.Command(d.Workstation9Driver.VmrunPath,
"-T", "ws", "-T", "ws",
"clone", src, dst, "clone", src, dst,
"full") "full")
if _, _, err := runAndLog(cmd); err != nil { if _, _, err := runAndLog(cmd); err != nil {
return err return err
} }
return nil return nil
} }
func (d *Workstation10Driver) Verify() error { func (d *Workstation10Driver) Verify() error {
if runtime.GOOS != "linux" { if runtime.GOOS != "linux" {
return fmt.Errorf("can't used driver WS 10 not yet supported on: %s", runtime.GOOS) return fmt.Errorf("WS10 driver is only supported on Linux at the moment. Your OS: %s", runtime.GOOS)
} }
if err := d.Workstation9Driver.Verify(); err != nil {
return err
}
if err := d.Workstation9Driver.Verify(); err != nil {
return err
}
//TODO(pmyjavec) there is a better way to find this, how? //TODO(pmyjavec) there is a better way to find this, how?
//the default will suffice for now. //the default will suffice for now.
vmxpath := "/usr/lib/vmware/bin/vmware-vmx" vmxpath := "/usr/lib/vmware/bin/vmware-vmx"
var stderr bytes.Buffer var stderr bytes.Buffer
cmd := exec.Command(vmxpath, "-v") cmd := exec.Command(vmxpath, "-v")
...@@ -64,5 +63,5 @@ func (d *Workstation10Driver) Verify() error { ...@@ -64,5 +63,5 @@ func (d *Workstation10Driver) Verify() error {
"WS 10 not detected. Got version: %s", matches[1]) "WS 10 not detected. Got version: %s", matches[1])
} }
return nil return nil
} }
...@@ -233,7 +233,7 @@ func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator) err ...@@ -233,7 +233,7 @@ func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator) err
} }
if cmd.ExitStatus != 0 { if cmd.ExitStatus != 0 {
if cmd.ExitStatus == 127 { if cmd.ExitStatus == 127 {
return fmt.Errorf("%s could not be found. Verify that it is available on the\n" + return fmt.Errorf("%s could not be found. Verify that it is available on the\n"+
"PATH after connecting to the machine.", "PATH after connecting to the machine.",
p.config.Command) p.config.Command)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment