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
429ff621
Commit
429ff621
authored
Jun 05, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: Add a boot wait in seconds
parent
009b5091
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
builder/vmware/builder.go
builder/vmware/builder.go
+6
-5
builder/vmware/step_http_server.go
builder/vmware/step_http_server.go
+1
-1
builder/vmware/step_run.go
builder/vmware/step_run.go
+10
-1
No files found.
builder/vmware/builder.go
View file @
429ff621
...
@@ -14,12 +14,13 @@ type Builder struct {
...
@@ -14,12 +14,13 @@ type Builder struct {
}
}
type
config
struct
{
type
config
struct
{
DiskName
string
`mapstructure:"vmdk_name"`
DiskName
string
`mapstructure:"vmdk_name"`
ISOUrl
string
`mapstructure:"iso_url"`
ISOUrl
string
`mapstructure:"iso_url"`
VMName
string
`mapstructure:"vm_name"`
VMName
string
`mapstructure:"vm_name"`
OutputDir
string
`mapstructure:"output_directory"`
OutputDir
string
`mapstructure:"output_directory"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPDir
string
`mapstructure:"http_directory"`
BootCommand
[]
string
`mapstructure:"boot_command"`
BootCommand
[]
string
`mapstructure:"boot_command"`
BootWait
uint
`mapstructure:"boot_wait"`
}
}
func
(
b
*
Builder
)
Prepare
(
raw
interface
{})
(
err
error
)
{
func
(
b
*
Builder
)
Prepare
(
raw
interface
{})
(
err
error
)
{
...
...
builder/vmware/step_http_server.go
View file @
429ff621
...
@@ -17,7 +17,7 @@ import (
...
@@ -17,7 +17,7 @@ import (
//
//
// Produces:
// Produces:
// http_port int - The port the HTTP server started on.
// http_port int - The port the HTTP server started on.
type
stepHTTPServer
struct
{
type
stepHTTPServer
struct
{
l
net
.
Listener
l
net
.
Listener
}
}
...
...
builder/vmware/step_run.go
View file @
429ff621
...
@@ -5,21 +5,24 @@ import (
...
@@ -5,21 +5,24 @@ import (
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"os/exec"
"os/exec"
"time"
)
)
// This step runs the created virtual machine.
// This step runs the created virtual machine.
//
//
// Uses:
// Uses:
// config *config
// ui packer.Ui
// ui packer.Ui
// vmx_path string
// vmx_path string
//
//
// Produces:
// Produces:
// <nothing>
// <nothing>
type
stepRun
struct
{
type
stepRun
struct
{
vmxPath
string
vmxPath
string
}
}
func
(
s
*
stepRun
)
Run
(
state
map
[
string
]
interface
{})
multistep
.
StepAction
{
func
(
s
*
stepRun
)
Run
(
state
map
[
string
]
interface
{})
multistep
.
StepAction
{
config
:=
state
[
"config"
]
.
(
*
config
)
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
vmxPath
:=
state
[
"vmx_path"
]
.
(
string
)
vmxPath
:=
state
[
"vmx_path"
]
.
(
string
)
...
@@ -35,6 +38,12 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
...
@@ -35,6 +38,12 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
// Set the VMX path so that we know we started the machine
// Set the VMX path so that we know we started the machine
s
.
vmxPath
=
vmxPath
s
.
vmxPath
=
vmxPath
// Wait the wait amount
if
config
.
BootWait
>
0
{
ui
.
Say
(
fmt
.
Sprintf
(
"Waiting %d seconds for boot..."
,
config
.
BootWait
))
time
.
Sleep
(
config
.
BootWait
*
time
.
Second
)
}
return
multistep
.
ActionContinue
return
multistep
.
ActionContinue
}
}
...
...
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