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
16960a52
Commit
16960a52
authored
Jul 14, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: unexport calculated fields
parent
05acb7b4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+7
-6
builder/virtualbox/step_run.go
builder/virtualbox/step_run.go
+3
-3
builder/virtualbox/step_shutdown.go
builder/virtualbox/step_shutdown.go
+2
-2
builder/virtualbox/step_wait_for_ssh.go
builder/virtualbox/step_wait_for_ssh.go
+2
-3
No files found.
builder/virtualbox/builder.go
View file @
16960a52
...
...
@@ -27,7 +27,6 @@ type Builder struct {
type
config
struct
{
BootCommand
[]
string
`mapstructure:"boot_command"`
BootWait
time
.
Duration
``
DiskSize
uint
`mapstructure:"disk_size"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
GuestAdditionsPath
string
`mapstructure:"guest_additions_path"`
...
...
@@ -43,13 +42,11 @@ type config struct {
ISOUrl
string
`mapstructure:"iso_url"`
OutputDir
string
`mapstructure:"output_directory"`
ShutdownCommand
string
`mapstructure:"shutdown_command"`
ShutdownTimeout
time
.
Duration
``
SSHHostPortMin
uint
`mapstructure:"ssh_host_port_min"`
SSHHostPortMax
uint
`mapstructure:"ssh_host_port_max"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHUser
string
`mapstructure:"ssh_username"`
SSHWaitTimeout
time
.
Duration
``
VBoxVersionFile
string
`mapstructure:"virtualbox_version_file"`
VBoxManage
[][]
string
`mapstructure:"vboxmanage"`
VMName
string
`mapstructure:"vm_name"`
...
...
@@ -61,6 +58,10 @@ type config struct {
RawBootWait
string
`mapstructure:"boot_wait"`
RawShutdownTimeout
string
`mapstructure:"shutdown_timeout"`
RawSSHWaitTimeout
string
`mapstructure:"ssh_wait_timeout"`
bootWait
time
.
Duration
``
shutdownTimeout
time
.
Duration
``
sshWaitTimeout
time
.
Duration
``
}
func
(
b
*
Builder
)
Prepare
(
raws
...
interface
{})
error
{
...
...
@@ -261,7 +262,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
}
b
.
config
.
B
ootWait
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawBootWait
)
b
.
config
.
b
ootWait
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawBootWait
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Failed parsing boot_wait: %s"
,
err
))
}
...
...
@@ -274,7 +275,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b
.
config
.
RawSSHWaitTimeout
=
"20m"
}
b
.
config
.
S
hutdownTimeout
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawShutdownTimeout
)
b
.
config
.
s
hutdownTimeout
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawShutdownTimeout
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Failed parsing shutdown_timeout: %s"
,
err
))
}
...
...
@@ -287,7 +288,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
errs
=
append
(
errs
,
errors
.
New
(
"An ssh_username must be specified."
))
}
b
.
config
.
SSH
WaitTimeout
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawSSHWaitTimeout
)
b
.
config
.
ssh
WaitTimeout
,
err
=
time
.
ParseDuration
(
b
.
config
.
RawSSHWaitTimeout
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Failed parsing ssh_wait_timeout: %s"
,
err
))
}
...
...
builder/virtualbox/step_run.go
View file @
16960a52
...
...
@@ -40,9 +40,9 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
s
.
vmName
=
vmName
if
int64
(
config
.
B
ootWait
)
>
0
{
ui
.
Say
(
fmt
.
Sprintf
(
"Waiting %s for boot..."
,
config
.
B
ootWait
))
time
.
Sleep
(
config
.
B
ootWait
)
if
int64
(
config
.
b
ootWait
)
>
0
{
ui
.
Say
(
fmt
.
Sprintf
(
"Waiting %s for boot..."
,
config
.
b
ootWait
))
time
.
Sleep
(
config
.
b
ootWait
)
}
return
multistep
.
ActionContinue
...
...
builder/virtualbox/step_shutdown.go
View file @
16960a52
...
...
@@ -45,8 +45,8 @@ func (s *stepShutdown) Run(state map[string]interface{}) multistep.StepAction {
cmd
.
Wait
()
// Wait for the machine to actually shut down
log
.
Printf
(
"Waiting max %s for shutdown to complete"
,
config
.
S
hutdownTimeout
)
shutdownTimer
:=
time
.
After
(
config
.
S
hutdownTimeout
)
log
.
Printf
(
"Waiting max %s for shutdown to complete"
,
config
.
s
hutdownTimeout
)
shutdownTimer
:=
time
.
After
(
config
.
s
hutdownTimeout
)
for
{
running
,
_
:=
driver
.
IsRunning
(
vmName
)
if
!
running
{
...
...
builder/virtualbox/step_wait_for_ssh.go
View file @
16960a52
...
...
@@ -39,9 +39,8 @@ func (s *stepWaitForSSH) Run(state map[string]interface{}) multistep.StepAction
waitDone
<-
true
}()
log
.
Printf
(
"Waiting for SSH, up to timeout: %s"
,
config
.
SSHWaitTimeout
.
String
())
timeout
:=
time
.
After
(
config
.
SSHWaitTimeout
)
log
.
Printf
(
"Waiting for SSH, up to timeout: %s"
,
config
.
sshWaitTimeout
.
String
())
timeout
:=
time
.
After
(
config
.
sshWaitTimeout
)
WaitLoop
:
for
{
// Wait for either SSH to become available, a timeout to occur,
...
...
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