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
61320b20
Commit
61320b20
authored
Sep 12, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon/common: error if WaitForState can't find resource
repeatably
parent
1bf91e28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/amazon/common/state.go
builder/amazon/common/state.go
+13
-3
No files found.
CHANGELOG.md
View file @
61320b20
...
...
@@ -7,6 +7,8 @@ IMPROVEMENTS:
BUG FIXES:
*
builder/amazon/
*
: While waiting for AMI, will detect "failed" state.
*
builder/amazon/
*
: Waiting for state will detect if the resource (AMI,
instance, etc.) disappears from under it.
*
provisioner/puppet-masterless: Fix failure case when both facter vars
are used and prevent_sudo. [GH-415]
...
...
builder/amazon/common/state.go
View file @
61320b20
...
...
@@ -82,6 +82,8 @@ func InstanceStateRefreshFunc(conn *ec2.EC2, i *ec2.Instance) StateRefreshFunc {
func
WaitForState
(
conf
*
StateChangeConf
)
(
i
interface
{},
err
error
)
{
log
.
Printf
(
"Waiting for state to become: %s"
,
conf
.
Target
)
notfoundTick
:=
0
for
{
var
currentState
string
i
,
currentState
,
err
=
conf
.
Refresh
()
...
...
@@ -89,9 +91,17 @@ func WaitForState(conf *StateChangeConf) (i interface{}, err error) {
return
}
// Check states only if we were able to refresh to an instance
// that exists.
if
i
!=
nil
{
if
i
==
nil
{
// If we didn't find the resource, check if we have been
// not finding it for awhile, and if so, report an error.
notfoundTick
+=
1
if
notfoundTick
>
20
{
return
nil
,
errors
.
New
(
"couldn't find resource"
)
}
}
else
{
// Reset the counter for when a resource isn't found
notfoundTick
=
0
if
currentState
==
conf
.
Target
{
return
}
...
...
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