Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
458bfd18
Commit
458bfd18
authored
Dec 24, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: move driver out of ISO
parent
d73cbd37
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
60 additions
and
67 deletions
+60
-67
builder/vmware/common/ssh.go
builder/vmware/common/ssh.go
+2
-2
builder/vmware/iso/builder.go
builder/vmware/iso/builder.go
+1
-1
builder/vmware/iso/driver.go
builder/vmware/iso/driver.go
+8
-45
builder/vmware/iso/driver_esx5_test.go
builder/vmware/iso/driver_esx5_test.go
+2
-1
builder/vmware/iso/driver_fusion5.go
builder/vmware/iso/driver_fusion5.go
+7
-2
builder/vmware/iso/driver_player5.go
builder/vmware/iso/driver_player5.go
+7
-2
builder/vmware/iso/driver_workstation9.go
builder/vmware/iso/driver_workstation9.go
+7
-2
builder/vmware/iso/guest_ip.go
builder/vmware/iso/guest_ip.go
+3
-1
builder/vmware/iso/remote_driver.go
builder/vmware/iso/remote_driver.go
+5
-1
builder/vmware/iso/step_compact_disk.go
builder/vmware/iso/step_compact_disk.go
+2
-1
builder/vmware/iso/step_configure_vnc.go
builder/vmware/iso/step_configure_vnc.go
+1
-1
builder/vmware/iso/step_create_disk.go
builder/vmware/iso/step_create_disk.go
+2
-1
builder/vmware/iso/step_prepare_tools.go
builder/vmware/iso/step_prepare_tools.go
+2
-1
builder/vmware/iso/step_remote_upload.go
builder/vmware/iso/step_remote_upload.go
+2
-1
builder/vmware/iso/step_run.go
builder/vmware/iso/step_run.go
+3
-2
builder/vmware/iso/step_shutdown.go
builder/vmware/iso/step_shutdown.go
+2
-1
builder/vmware/iso/step_suppress_messages.go
builder/vmware/iso/step_suppress_messages.go
+2
-1
builder/vmware/iso/step_type_boot_command.go
builder/vmware/iso/step_type_boot_command.go
+2
-1
No files found.
builder/vmware/common/ssh.go
View file @
458bfd18
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
"github.com/mitchellh/packer/communicator/ssh"
"github.com/mitchellh/packer/communicator/ssh"
)
)
func
sshAddress
(
config
*
SSHConfig
)
func
(
multistep
.
StateBag
)
(
string
,
error
)
{
func
SSHAddressFunc
(
config
*
SSHConfig
)
func
(
multistep
.
StateBag
)
(
string
,
error
)
{
return
func
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
return
func
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
...
@@ -61,7 +61,7 @@ func sshAddress(config *SSHConfig) func(multistep.StateBag) (string, error) {
...
@@ -61,7 +61,7 @@ func sshAddress(config *SSHConfig) func(multistep.StateBag) (string, error) {
}
}
}
}
func
sshConfig
(
config
*
SSHConfig
)
func
(
multistep
.
StateBag
)
(
*
gossh
.
ClientConfig
,
error
)
{
func
SSHConfigFunc
(
config
*
SSHConfig
)
func
(
multistep
.
StateBag
)
(
*
gossh
.
ClientConfig
,
error
)
{
return
func
(
state
multistep
.
StateBag
)
(
*
gossh
.
ClientConfig
,
error
)
{
return
func
(
state
multistep
.
StateBag
)
(
*
gossh
.
ClientConfig
,
error
)
{
auth
:=
[]
gossh
.
ClientAuth
{
auth
:=
[]
gossh
.
ClientAuth
{
gossh
.
ClientAuthPassword
(
ssh
.
Password
(
config
.
SSHPassword
)),
gossh
.
ClientAuthPassword
(
ssh
.
Password
(
config
.
SSHPassword
)),
...
...
builder/vmware/iso/builder.go
View file @
458bfd18
...
@@ -399,7 +399,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -399,7 +399,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
stepTypeBootCommand
{},
&
stepTypeBootCommand
{},
&
common
.
StepConnectSSH
{
&
common
.
StepConnectSSH
{
SSHAddress
:
driver
.
SSHAddress
,
SSHAddress
:
driver
.
SSHAddress
,
SSHConfig
:
sshConfig
,
SSHConfig
:
vmwcommon
.
SSHConfigFunc
(
&
b
.
config
.
SSHConfig
)
,
SSHWaitTimeout
:
b
.
config
.
SSHWaitTimeout
,
SSHWaitTimeout
:
b
.
config
.
SSHWaitTimeout
,
NoPty
:
b
.
config
.
SSHSkipRequestPty
,
NoPty
:
b
.
config
.
SSHSkipRequestPty
,
},
},
...
...
builder/vmware/iso/driver.go
View file @
458bfd18
...
@@ -3,58 +3,21 @@ package iso
...
@@ -3,58 +3,21 @@ package iso
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"log"
"log"
"os/exec"
"os/exec"
"runtime"
"runtime"
"strings"
"strings"
)
// A driver is able to talk to VMware, control virtual machines, etc.
type
Driver
interface
{
// CompactDisk compacts a virtual disk.
CompactDisk
(
string
)
error
// CreateDisk creates a virtual disk with the given size.
CreateDisk
(
string
,
string
,
string
)
error
// Checks if the VMX file at the given path is running.
IsRunning
(
string
)
(
bool
,
error
)
// SSHAddress returns the SSH address for the VM that is being
// managed by this driver.
SSHAddress
(
multistep
.
StateBag
)
(
string
,
error
)
// Start starts a VM specified by the path to the VMX given.
Start
(
string
,
bool
)
error
// Stop stops a VM specified by the path to the VMX given.
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
Stop
(
string
)
error
)
// SuppressMessages modifies the VMX or surrounding directory so that
// VMware doesn't show any annoying messages.
SuppressMessages
(
string
)
error
// Get the path to the VMware ISO for the given flavor.
ToolsIsoPath
(
string
)
string
// Get the path to the DHCP leases file for the given device.
DhcpLeasesPath
(
string
)
string
// Verify checks to make sure that this driver should function
// properly. This should check that all the files it will use
// appear to exist and so on. If everything is okay, this doesn't
// return an error. Otherwise, this returns an error.
Verify
()
error
}
// NewDriver returns a new driver implementation for this operating
// NewDriver returns a new driver implementation for this operating
// system, or an error if the driver couldn't be initialized.
// system, or an error if the driver couldn't be initialized.
func
NewDriver
(
config
*
config
)
(
Driver
,
error
)
{
func
NewDriver
(
config
*
config
)
(
vmwcommon
.
Driver
,
error
)
{
drivers
:=
[]
Driver
{}
drivers
:=
[]
vmwcommon
.
Driver
{}
if
config
.
RemoteType
!=
""
{
if
config
.
RemoteType
!=
""
{
drivers
=
[]
Driver
{
drivers
=
[]
vmwcommon
.
Driver
{
&
ESX5Driver
{
&
ESX5Driver
{
Host
:
config
.
RemoteHost
,
Host
:
config
.
RemoteHost
,
Port
:
config
.
RemotePort
,
Port
:
config
.
RemotePort
,
...
@@ -66,18 +29,18 @@ func NewDriver(config *config) (Driver, error) {
...
@@ -66,18 +29,18 @@ func NewDriver(config *config) (Driver, error) {
}
else
{
}
else
{
switch
runtime
.
GOOS
{
switch
runtime
.
GOOS
{
case
"darwin"
:
case
"darwin"
:
drivers
=
[]
Driver
{
drivers
=
[]
vmwcommon
.
Driver
{
&
Fusion5Driver
{
&
Fusion5Driver
{
AppPath
:
"/Applications/VMware Fusion.app"
,
AppPath
:
"/Applications/VMware Fusion.app"
,
},
},
}
}
case
"linux"
:
case
"linux"
:
drivers
=
[]
Driver
{
drivers
=
[]
vmwcommon
.
Driver
{
new
(
Workstation9Driver
),
new
(
Workstation9Driver
),
new
(
Player5LinuxDriver
),
new
(
Player5LinuxDriver
),
}
}
case
"windows"
:
case
"windows"
:
drivers
=
[]
Driver
{
drivers
=
[]
vmwcommon
.
Driver
{
new
(
Workstation9Driver
),
new
(
Workstation9Driver
),
}
}
default
:
default
:
...
...
builder/vmware/iso/driver_esx5_test.go
View file @
458bfd18
package
iso
package
iso
import
(
import
(
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"testing"
"testing"
)
)
func
TestESX5Driver_implDriver
(
t
*
testing
.
T
)
{
func
TestESX5Driver_implDriver
(
t
*
testing
.
T
)
{
var
_
Driver
=
new
(
ESX5Driver
)
var
_
vmwcommon
.
Driver
=
new
(
ESX5Driver
)
}
}
func
TestESX5Driver_implRemoteDriver
(
t
*
testing
.
T
)
{
func
TestESX5Driver_implRemoteDriver
(
t
*
testing
.
T
)
{
...
...
builder/vmware/iso/driver_fusion5.go
View file @
458bfd18
...
@@ -2,18 +2,23 @@ package iso
...
@@ -2,18 +2,23 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"io/ioutil"
"io/ioutil"
"os"
"os"
"os/exec"
"os/exec"
"path/filepath"
"path/filepath"
"strings"
"strings"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
)
)
// Fusion5Driver is a driver that can run VMWare Fusion 5.
// Fusion5Driver is a driver that can run VMWare Fusion 5.
type
Fusion5Driver
struct
{
type
Fusion5Driver
struct
{
// This is the path to the "VMware Fusion.app"
// This is the path to the "VMware Fusion.app"
AppPath
string
AppPath
string
// SSHConfig are the SSH settings for the Fusion VM
SSHConfig
*
vmwcommon
.
SSHConfig
}
}
func
(
d
*
Fusion5Driver
)
CompactDisk
(
diskPath
string
)
error
{
func
(
d
*
Fusion5Driver
)
CompactDisk
(
diskPath
string
)
error
{
...
@@ -61,7 +66,7 @@ func (d *Fusion5Driver) IsRunning(vmxPath string) (bool, error) {
...
@@ -61,7 +66,7 @@ func (d *Fusion5Driver) IsRunning(vmxPath string) (bool, error) {
}
}
func
(
d
*
Fusion5Driver
)
SSHAddress
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
func
(
d
*
Fusion5Driver
)
SSHAddress
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
return
sshAddress
(
state
)
return
vmwcommon
.
SSHAddressFunc
(
d
.
SSHConfig
)
(
state
)
}
}
func
(
d
*
Fusion5Driver
)
Start
(
vmxPath
string
,
headless
bool
)
error
{
func
(
d
*
Fusion5Driver
)
Start
(
vmxPath
string
,
headless
bool
)
error
{
...
...
builder/vmware/iso/driver_player5.go
View file @
458bfd18
...
@@ -2,11 +2,13 @@ package iso
...
@@ -2,11 +2,13 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"os"
"os"
"os/exec"
"os/exec"
"path/filepath"
"path/filepath"
"strings"
"strings"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
)
)
// Player5LinuxDriver is a driver that can run VMware Player 5 on Linux.
// Player5LinuxDriver is a driver that can run VMware Player 5 on Linux.
...
@@ -15,6 +17,9 @@ type Player5LinuxDriver struct {
...
@@ -15,6 +17,9 @@ type Player5LinuxDriver struct {
VdiskManagerPath
string
VdiskManagerPath
string
QemuImgPath
string
QemuImgPath
string
VmrunPath
string
VmrunPath
string
// SSHConfig are the SSH settings for the Fusion VM
SSHConfig
*
vmwcommon
.
SSHConfig
}
}
func
(
d
*
Player5LinuxDriver
)
CompactDisk
(
diskPath
string
)
error
{
func
(
d
*
Player5LinuxDriver
)
CompactDisk
(
diskPath
string
)
error
{
...
@@ -88,7 +93,7 @@ func (d *Player5LinuxDriver) IsRunning(vmxPath string) (bool, error) {
...
@@ -88,7 +93,7 @@ func (d *Player5LinuxDriver) IsRunning(vmxPath string) (bool, error) {
}
}
func
(
d
*
Player5LinuxDriver
)
SSHAddress
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
func
(
d
*
Player5LinuxDriver
)
SSHAddress
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
return
sshAddress
(
state
)
return
vmwcommon
.
SSHAddressFunc
(
d
.
SSHConfig
)
(
state
)
}
}
func
(
d
*
Player5LinuxDriver
)
Start
(
vmxPath
string
,
headless
bool
)
error
{
func
(
d
*
Player5LinuxDriver
)
Start
(
vmxPath
string
,
headless
bool
)
error
{
...
...
builder/vmware/iso/driver_workstation9.go
View file @
458bfd18
...
@@ -2,12 +2,14 @@ package iso
...
@@ -2,12 +2,14 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"log"
"log"
"os"
"os"
"os/exec"
"os/exec"
"path/filepath"
"path/filepath"
"strings"
"strings"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
)
)
// Workstation9Driver is a driver that can run VMware Workstation 9
// Workstation9Driver is a driver that can run VMware Workstation 9
...
@@ -16,6 +18,9 @@ type Workstation9Driver struct {
...
@@ -16,6 +18,9 @@ type Workstation9Driver struct {
AppPath
string
AppPath
string
VdiskManagerPath
string
VdiskManagerPath
string
VmrunPath
string
VmrunPath
string
// SSHConfig are the SSH settings for the Fusion VM
SSHConfig
*
vmwcommon
.
SSHConfig
}
}
func
(
d
*
Workstation9Driver
)
CompactDisk
(
diskPath
string
)
error
{
func
(
d
*
Workstation9Driver
)
CompactDisk
(
diskPath
string
)
error
{
...
@@ -63,7 +68,7 @@ func (d *Workstation9Driver) IsRunning(vmxPath string) (bool, error) {
...
@@ -63,7 +68,7 @@ func (d *Workstation9Driver) IsRunning(vmxPath string) (bool, error) {
}
}
func
(
d
*
Workstation9Driver
)
SSHAddress
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
func
(
d
*
Workstation9Driver
)
SSHAddress
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
return
sshAddress
(
state
)
return
vmwcommon
.
SSHAddressFunc
(
d
.
SSHConfig
)
(
state
)
}
}
func
(
d
*
Workstation9Driver
)
Start
(
vmxPath
string
,
headless
bool
)
error
{
func
(
d
*
Workstation9Driver
)
Start
(
vmxPath
string
,
headless
bool
)
error
{
...
...
builder/vmware/iso/guest_ip.go
View file @
458bfd18
...
@@ -8,6 +8,8 @@ import (
...
@@ -8,6 +8,8 @@ import (
"regexp"
"regexp"
"strings"
"strings"
"time"
"time"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
)
)
// Interface to help find the IP address of a running virtual machine.
// Interface to help find the IP address of a running virtual machine.
...
@@ -19,7 +21,7 @@ type GuestIPFinder interface {
...
@@ -19,7 +21,7 @@ type GuestIPFinder interface {
// lease information from the VMware network devices.
// lease information from the VMware network devices.
type
DHCPLeaseGuestLookup
struct
{
type
DHCPLeaseGuestLookup
struct
{
// Driver that is being used (to find leases path)
// Driver that is being used (to find leases path)
Driver
Driver
Driver
vmwcommon
.
Driver
// Device that the guest is connected to.
// Device that the guest is connected to.
Device
string
Device
string
...
...
builder/vmware/iso/remote_driver.go
View file @
458bfd18
package
iso
package
iso
import
(
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
)
type
RemoteDriver
interface
{
type
RemoteDriver
interface
{
Driver
vmwcommon
.
Driver
// UploadISO uploads a local ISO to the remote side and returns the
// UploadISO uploads a local ISO to the remote side and returns the
// new path that should be used in the VMX along with an error if it
// new path that should be used in the VMX along with an error if it
...
...
builder/vmware/iso/step_compact_disk.go
View file @
458bfd18
...
@@ -3,6 +3,7 @@ package iso
...
@@ -3,6 +3,7 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"log"
"log"
)
)
...
@@ -22,7 +23,7 @@ type stepCompactDisk struct{}
...
@@ -22,7 +23,7 @@ type stepCompactDisk struct{}
func
(
stepCompactDisk
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
stepCompactDisk
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
full_disk_path
:=
state
.
Get
(
"full_disk_path"
)
.
(
string
)
full_disk_path
:=
state
.
Get
(
"full_disk_path"
)
.
(
string
)
...
...
builder/vmware/iso/step_configure_vnc.go
View file @
458bfd18
...
@@ -47,7 +47,7 @@ func (stepConfigureVNC) VNCAddress(portMin, portMax uint) (string, uint) {
...
@@ -47,7 +47,7 @@ func (stepConfigureVNC) VNCAddress(portMin, portMax uint) (string, uint) {
func
(
s
*
stepConfigureVNC
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepConfigureVNC
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
...
...
builder/vmware/iso/step_create_disk.go
View file @
458bfd18
...
@@ -3,6 +3,7 @@ package iso
...
@@ -3,6 +3,7 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"path/filepath"
"path/filepath"
)
)
...
@@ -20,7 +21,7 @@ type stepCreateDisk struct{}
...
@@ -20,7 +21,7 @@ type stepCreateDisk struct{}
func
(
stepCreateDisk
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
stepCreateDisk
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
.
Say
(
"Creating virtual machine disk"
)
ui
.
Say
(
"Creating virtual machine disk"
)
...
...
builder/vmware/iso/step_prepare_tools.go
View file @
458bfd18
...
@@ -3,6 +3,7 @@ package iso
...
@@ -3,6 +3,7 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"os"
"os"
)
)
...
@@ -10,7 +11,7 @@ type stepPrepareTools struct{}
...
@@ -10,7 +11,7 @@ type stepPrepareTools struct{}
func
(
*
stepPrepareTools
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
*
stepPrepareTools
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
if
config
.
ToolsUploadFlavor
==
""
{
if
config
.
ToolsUploadFlavor
==
""
{
return
multistep
.
ActionContinue
return
multistep
.
ActionContinue
...
...
builder/vmware/iso/step_remote_upload.go
View file @
458bfd18
...
@@ -3,6 +3,7 @@ package iso
...
@@ -3,6 +3,7 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"log"
"log"
)
)
...
@@ -15,7 +16,7 @@ type stepRemoteUpload struct {
...
@@ -15,7 +16,7 @@ type stepRemoteUpload struct {
}
}
func
(
s
*
stepRemoteUpload
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepRemoteUpload
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
remote
,
ok
:=
driver
.
(
RemoteDriver
)
remote
,
ok
:=
driver
.
(
RemoteDriver
)
...
...
builder/vmware/iso/step_run.go
View file @
458bfd18
...
@@ -3,6 +3,7 @@ package iso
...
@@ -3,6 +3,7 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"time"
"time"
)
)
...
@@ -26,7 +27,7 @@ type stepRun struct {
...
@@ -26,7 +27,7 @@ type stepRun struct {
func
(
s
*
stepRun
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepRun
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
vncIp
:=
state
.
Get
(
"vnc_ip"
)
.
(
string
)
vncIp
:=
state
.
Get
(
"vnc_ip"
)
.
(
string
)
...
@@ -84,7 +85,7 @@ func (s *stepRun) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -84,7 +85,7 @@ func (s *stepRun) Run(state multistep.StateBag) multistep.StepAction {
}
}
func
(
s
*
stepRun
)
Cleanup
(
state
multistep
.
StateBag
)
{
func
(
s
*
stepRun
)
Cleanup
(
state
multistep
.
StateBag
)
{
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
// If we started the machine... stop it.
// If we started the machine... stop it.
...
...
builder/vmware/iso/step_shutdown.go
View file @
458bfd18
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"log"
"log"
"path/filepath"
"path/filepath"
...
@@ -30,7 +31,7 @@ type stepShutdown struct{}
...
@@ -30,7 +31,7 @@ type stepShutdown struct{}
func
(
s
*
stepShutdown
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepShutdown
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
comm
:=
state
.
Get
(
"communicator"
)
.
(
packer
.
Communicator
)
comm
:=
state
.
Get
(
"communicator"
)
.
(
packer
.
Communicator
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
...
...
builder/vmware/iso/step_suppress_messages.go
View file @
458bfd18
...
@@ -3,6 +3,7 @@ package iso
...
@@ -3,6 +3,7 @@ package iso
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"log"
"log"
)
)
...
@@ -11,7 +12,7 @@ import (
...
@@ -11,7 +12,7 @@ import (
type
stepSuppressMessages
struct
{}
type
stepSuppressMessages
struct
{}
func
(
s
*
stepSuppressMessages
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepSuppressMessages
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
...
...
builder/vmware/iso/step_type_boot_command.go
View file @
458bfd18
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"fmt"
"fmt"
"github.com/mitchellh/go-vnc"
"github.com/mitchellh/go-vnc"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vmwcommon
"github.com/mitchellh/packer/builder/vmware/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"log"
"log"
"net"
"net"
...
@@ -36,7 +37,7 @@ type stepTypeBootCommand struct{}
...
@@ -36,7 +37,7 @@ type stepTypeBootCommand struct{}
func
(
s
*
stepTypeBootCommand
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepTypeBootCommand
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vmwcommon
.
Driver
)
httpPort
:=
state
.
Get
(
"http_port"
)
.
(
uint
)
httpPort
:=
state
.
Get
(
"http_port"
)
.
(
uint
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
vncIp
:=
state
.
Get
(
"vnc_ip"
)
.
(
string
)
vncIp
:=
state
.
Get
(
"vnc_ip"
)
.
(
string
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment