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
747f2606
Commit
747f2606
authored
Aug 27, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: template error if override specified for bad builder [GH-336]
parent
b4b68bce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
CHANGELOG.md
CHANGELOG.md
+2
-0
packer/template.go
packer/template.go
+8
-0
packer/template_test.go
packer/template_test.go
+28
-0
No files found.
CHANGELOG.md
View file @
747f2606
...
...
@@ -26,6 +26,8 @@ IMPROVEMENTS:
BUG FIXES:
*
core: Fixed a couple cases where a double ctrl-C could panic.
*
core: Template validation fails if an override is specified for a
non-existent builder. [GH-336]
*
builder/amazon/instance: Remove check for ec2-ami-tools because it
didn't allow absolute paths to work properly. [GH-330]
*
builder/digitalocean: Send a soft shutdown request so that files
...
...
packer/template.go
View file @
747f2606
...
...
@@ -221,6 +221,14 @@ func ParseTemplate(data []byte) (t *Template, err error) {
// actively reject them as invalid configuration.
delete
(
v
,
"override"
)
// Verify that the override keys exist...
for
name
,
_
:=
range
raw
.
Override
{
if
_
,
ok
:=
t
.
Builders
[
name
];
!
ok
{
errors
=
append
(
errors
,
fmt
.
Errorf
(
"provisioner %d: build '%s' not found for override"
,
i
+
1
,
name
))
}
}
raw
.
RawConfig
=
v
}
...
...
packer/template_test.go
View file @
747f2606
...
...
@@ -700,6 +700,34 @@ func TestTemplate_Build_ProvisionerOverride(t *testing.T) {
assert
.
Equal
(
len
(
coreBuild
.
provisioners
[
0
]
.
config
),
2
,
"should have two configs on the provisioner"
)
}
func
TestTemplate_Build_ProvisionerOverrideBad
(
t
*
testing
.
T
)
{
data
:=
`
{
"builders": [
{
"name": "test1",
"type": "test-builder"
}
],
"provisioners": [
{
"type": "test-prov",
"override": {
"testNope": {}
}
}
]
}
`
_
,
err
:=
ParseTemplate
([]
byte
(
data
))
if
err
==
nil
{
t
.
Fatal
(
"should have error"
)
}
}
func
TestTemplateBuild_variables
(
t
*
testing
.
T
)
{
data
:=
`
{
...
...
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