builder/amazonebs: Don't worry about the map[string]interface crap

pull/15/head
Mitchell Hashimoto 13 years ago
parent c580faa1a5
commit 4c37ce5304

@ -2,7 +2,6 @@ package amazonebs
import (
"encoding/json"
"errors"
"github.com/mitchellh/packer/packer"
"log"
)
@ -19,12 +18,6 @@ type Builder struct {
}
func (b *Builder) Prepare(raw interface{}) (err error) {
_, ok := raw.(map[string]interface{})
if !ok {
err = errors.New("configuration isn't a valid map")
return
}
jsonBytes, err := json.Marshal(raw)
if err != nil {
return

@ -13,15 +13,6 @@ func TestBuilder_ImplementsBuilder(t *testing.T) {
assert.Implementor(&Builder{}, &actual, "should be a Builder")
}
func TestBuilder_Prepare_NotMap(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
b := &Builder{}
err := b.Prepare(42)
assert.NotNil(err, "should have an error")
assert.Equal(err.Error(), "configuration isn't a valid map", "config is not a map")
}
func TestBuilder_Prepare_BadType(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)

@ -5,7 +5,7 @@
{
"type": "amazon-ebs",
"region": "us-east-1",
"source": "ami-de0d9eb7"
"source_ami": "ami-de0d9eb7"
}
],

Loading…
Cancel
Save