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
174ae65a
Commit
174ae65a
authored
Jun 08, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: Handle interrupts while waiting for SSH
parent
be1e60aa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
builder/vmware/step_wait_for_ssh.go
builder/vmware/step_wait_for_ssh.go
+21
-10
No files found.
builder/vmware/step_wait_for_ssh.go
View file @
174ae65a
...
@@ -44,6 +44,10 @@ func (s *stepWaitForSSH) Run(state map[string]interface{}) multistep.StepAction
...
@@ -44,6 +44,10 @@ func (s *stepWaitForSSH) Run(state map[string]interface{}) multistep.StepAction
log
.
Printf
(
"Waiting for SSH, up to timeout: %s"
,
config
.
SSHWaitTimeout
.
String
())
log
.
Printf
(
"Waiting for SSH, up to timeout: %s"
,
config
.
SSHWaitTimeout
.
String
())
timeout
:=
time
.
After
(
config
.
SSHWaitTimeout
)
for
{
// Wait for either SSH to become available, a timeout to occur,
// or an interrupt to come through.
select
{
select
{
case
<-
waitDone
:
case
<-
waitDone
:
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -52,10 +56,17 @@ func (s *stepWaitForSSH) Run(state map[string]interface{}) multistep.StepAction
...
@@ -52,10 +56,17 @@ func (s *stepWaitForSSH) Run(state map[string]interface{}) multistep.StepAction
}
}
state
[
"communicator"
]
=
comm
state
[
"communicator"
]
=
comm
case
<-
time
.
After
(
config
.
SSHWaitTimeout
)
:
break
case
<-
timeout
:
ui
.
Error
(
"Timeout waiting for SSH."
)
ui
.
Error
(
"Timeout waiting for SSH."
)
s
.
cancel
=
true
s
.
cancel
=
true
return
multistep
.
ActionHalt
return
multistep
.
ActionHalt
case
<-
time
.
After
(
1
*
time
.
Second
)
:
if
_
,
ok
:=
state
[
multistep
.
StateCancelled
];
ok
{
log
.
Println
(
"Interrupt detected, quitting waiting for SSH."
)
return
multistep
.
ActionHalt
}
}
}
}
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