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
0e251176
Commit
0e251176
authored
Sep 05, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon/common: if instance query returns none, ignore
parent
d0c3cede
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
16 deletions
+28
-16
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/amazon/common/instance.go
builder/amazon/common/instance.go
+26
-16
No files found.
CHANGELOG.md
View file @
0e251176
...
...
@@ -25,6 +25,8 @@ BUG FIXES:
*
builder/amazon/all: When copying AMI to multiple regions, copy
the metadata (tags and attributes) as well. [GH-388]
*
builder/amazon/all: Fix panic case where eventually consistent
instance state caused an index out of bounds.
*
builder/vmware: Autoanswer VMware dialogs. [GH-393]
*
command/inspect: Fix weird output for default values for optional vars.
...
...
builder/amazon/common/instance.go
View file @
0e251176
...
...
@@ -40,6 +40,12 @@ func InstanceStateRefreshFunc(conn *ec2.EC2, i *ec2.Instance) StateRefreshFunc {
return
nil
,
""
,
err
}
if
len
(
resp
.
Reservations
)
==
0
||
len
(
resp
.
Reservations
[
0
]
.
Instances
)
==
0
{
// Sometimes AWS just has consistency issues and doesn't see
// our instance yet. Return an empty state.
return
nil
,
""
,
nil
}
i
=
&
resp
.
Reservations
[
0
]
.
Instances
[
0
]
return
i
,
i
.
State
.
Name
,
nil
}
...
...
@@ -57,27 +63,31 @@ func WaitForState(conf *StateChangeConf) (i interface{}, err error) {
return
}
if
currentState
==
conf
.
Target
{
return
}
// Check states only if we were able to refresh to an instance
// that exists.
if
i
!=
nil
{
if
currentState
==
conf
.
Target
{
return
}
if
conf
.
StepState
!=
nil
{
if
_
,
ok
:=
conf
.
StepState
.
GetOk
(
multistep
.
StateCancelled
);
ok
{
return
nil
,
errors
.
New
(
"interrupted"
)
if
conf
.
StepState
!=
nil
{
if
_
,
ok
:=
conf
.
StepState
.
GetOk
(
multistep
.
StateCancelled
);
ok
{
return
nil
,
errors
.
New
(
"interrupted"
)
}
}
}
found
:=
false
for
_
,
allowed
:=
range
conf
.
Pending
{
if
currentState
==
allowed
{
found
=
true
break
found
:=
false
for
_
,
allowed
:=
range
conf
.
Pending
{
if
currentState
==
allowed
{
found
=
true
break
}
}
}
if
!
found
{
fmt
.
Errorf
(
"unexpected state '%s', wanted target '%s'"
,
currentState
,
conf
.
Target
)
return
if
!
found
{
fmt
.
Errorf
(
"unexpected state '%s', wanted target '%s'"
,
currentState
,
conf
.
Target
)
return
}
}
time
.
Sleep
(
2
*
time
.
Second
)
...
...
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