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
6b6beae3
Commit
6b6beae3
authored
Jul 14, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: unexport calculted config fields
parent
16960a52
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
16 deletions
+16
-16
builder/vmware/builder.go
builder/vmware/builder.go
+7
-6
builder/vmware/builder_test.go
builder/vmware/builder_test.go
+2
-2
builder/vmware/step_run.go
builder/vmware/step_run.go
+3
-3
builder/vmware/step_shutdown.go
builder/vmware/step_shutdown.go
+2
-2
builder/vmware/step_wait_for_ssh.go
builder/vmware/step_wait_for_ssh.go
+2
-3
No files found.
builder/vmware/builder.go
View file @
6b6beae3
...
...
@@ -41,14 +41,11 @@ type config struct {
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
BootCommand
[]
string
`mapstructure:"boot_command"`
BootWait
time
.
Duration
``
SkipCompaction
bool
`mapstructure:"skip_compaction"`
ShutdownCommand
string
`mapstructure:"shutdown_command"`
ShutdownTimeout
time
.
Duration
``
SSHUser
string
`mapstructure:"ssh_username"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHWaitTimeout
time
.
Duration
``
ToolsUploadFlavor
string
`mapstructure:"tools_upload_flavor"`
ToolsUploadPath
string
`mapstructure:"tools_upload_path"`
VMXData
map
[
string
]
string
`mapstructure:"vmx_data"`
...
...
@@ -62,6 +59,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
{
...
...
@@ -222,7 +223,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
if
b
.
config
.
RawBootWait
!=
""
{
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
))
}
...
...
@@ -232,7 +233,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b
.
config
.
RawShutdownTimeout
=
"5m"
}
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
))
}
...
...
@@ -241,7 +242,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b
.
config
.
RawSSHWaitTimeout
=
"20m"
}
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/vmware/builder_test.go
View file @
6b6beae3
...
...
@@ -126,8 +126,8 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
t
.
Errorf
(
"bad output dir: %s"
,
b
.
config
.
OutputDir
)
}
if
b
.
config
.
SSH
WaitTimeout
!=
(
20
*
time
.
Minute
)
{
t
.
Errorf
(
"bad wait timeout: %s"
,
b
.
config
.
SSH
WaitTimeout
)
if
b
.
config
.
ssh
WaitTimeout
!=
(
20
*
time
.
Minute
)
{
t
.
Errorf
(
"bad wait timeout: %s"
,
b
.
config
.
ssh
WaitTimeout
)
}
if
b
.
config
.
VMName
!=
"packer-foo"
{
...
...
builder/vmware/step_run.go
View file @
6b6beae3
...
...
@@ -49,9 +49,9 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
}
// Wait the wait amount
if
int64
(
config
.
B
ootWait
)
>
0
{
ui
.
Say
(
fmt
.
Sprintf
(
"Waiting %s for boot..."
,
config
.
B
ootWait
.
String
()))
time
.
Sleep
(
config
.
B
ootWait
)
if
int64
(
config
.
b
ootWait
)
>
0
{
ui
.
Say
(
fmt
.
Sprintf
(
"Waiting %s for boot..."
,
config
.
b
ootWait
.
String
()))
time
.
Sleep
(
config
.
b
ootWait
)
}
return
multistep
.
ActionContinue
...
...
builder/vmware/step_shutdown.go
View file @
6b6beae3
...
...
@@ -65,8 +65,8 @@ func (s *stepShutdown) Run(state map[string]interface{}) multistep.StepAction {
log
.
Printf
(
"Shutdown stderr: %s"
,
stderr
.
String
())
// 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
(
vmxPath
)
if
!
running
{
...
...
builder/vmware/step_wait_for_ssh.go
View file @
6b6beae3
...
...
@@ -41,9 +41,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