packer: verify `except` has valid builders [GH-438]

This commit is contained in:
Mitchell Hashimoto 2013-09-20 11:18:00 -07:00
parent a31a4207df
commit 12ad2cf92e
2 changed files with 11 additions and 4 deletions

View File

@ -563,5 +563,12 @@ func (t *TemplateOnlyExcept) Validate(b map[string]RawBuilderConfig) (e []error)
}
}
for _, n := range t.Except {
if _, ok := b[n]; !ok {
e = append(e,
fmt.Errorf("'except' specified builder '%s' not found", n))
}
}
return
}

View File

@ -707,7 +707,7 @@ func TestTemplateBuild_exeptPPInvalid(t *testing.T) {
"post-processors": [
{
"type": "test-pp",
"except": "test5"
"except": ["test5"]
}
]
}
@ -787,7 +787,7 @@ func TestTemplateBuild_exceptProvInvalid(t *testing.T) {
"provisioners": [
{
"type": "test-prov",
"except": "test5"
"except": ["test5"]
}
]
}
@ -867,7 +867,7 @@ func TestTemplateBuild_onlyPPInvalid(t *testing.T) {
"post-processors": [
{
"type": "test-pp",
"only": "test5"
"only": ["test5"]
}
]
}
@ -947,7 +947,7 @@ func TestTemplateBuild_onlyProvInvalid(t *testing.T) {
"provisioners": [
{
"type": "test-prov",
"only": "test5"
"only": ["test5"]
}
]
}