Commit 4c37ce53 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

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

parent c580faa1
...@@ -2,7 +2,6 @@ package amazonebs ...@@ -2,7 +2,6 @@ package amazonebs
import ( import (
"encoding/json" "encoding/json"
"errors"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"log" "log"
) )
...@@ -19,12 +18,6 @@ type Builder struct { ...@@ -19,12 +18,6 @@ type Builder struct {
} }
func (b *Builder) Prepare(raw interface{}) (err error) { 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) jsonBytes, err := json.Marshal(raw)
if err != nil { if err != nil {
return return
......
...@@ -13,15 +13,6 @@ func TestBuilder_ImplementsBuilder(t *testing.T) { ...@@ -13,15 +13,6 @@ func TestBuilder_ImplementsBuilder(t *testing.T) {
assert.Implementor(&Builder{}, &actual, "should be a Builder") 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) { func TestBuilder_Prepare_BadType(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true) assert := asserts.NewTestingAsserts(t, true)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{ {
"type": "amazon-ebs", "type": "amazon-ebs",
"region": "us-east-1", "region": "us-east-1",
"source": "ami-de0d9eb7" "source_ami": "ami-de0d9eb7"
} }
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment