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
0505fb4a
Commit
0505fb4a
authored
Jul 11, 2013
by
Matt Surabian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate that instance exists and is EBS based before trying to launch it.
parent
0fdf9b09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
builder/amazonebs/step_run_source_instance.go
builder/amazonebs/step_run_source_instance.go
+16
-0
No files found.
builder/amazonebs/step_run_source_instance.go
View file @
0505fb4a
...
...
@@ -28,6 +28,22 @@ func (s *stepRunSourceInstance) Run(state map[string]interface{}) multistep.Step
SecurityGroups
:
[]
ec2
.
SecurityGroup
{
ec2
.
SecurityGroup
{
Id
:
securityGroupId
}},
}
ui
.
Say
(
"Validating Source AMI..."
)
imageResp
,
err
:=
ec2conn
.
Images
([]
string
{
config
.
SourceAmi
},
ec2
.
NewFilter
())
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"There was a problem with the provided source AMI: %s"
,
err
)
state
[
"error"
]
=
err
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
if
imageResp
.
Images
[
0
]
.
RootDeviceType
!=
"ebs"
{
err
:=
fmt
.
Errorf
(
"The provided source AMI is instance-store based. The amazon-ebs bundler can only work with EBS based AMIs."
)
state
[
"error"
]
=
err
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
ui
.
Say
(
"Launching a source AWS instance..."
)
runResp
,
err
:=
ec2conn
.
RunInstances
(
runOpts
)
if
err
!=
nil
{
...
...
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