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
4c37ce53
Commit
4c37ce53
authored
May 09, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazonebs: Don't worry about the map[string]interface crap
parent
c580faa1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
17 deletions
+1
-17
builder/amazonebs/builder.go
builder/amazonebs/builder.go
+0
-7
builder/amazonebs/builder_test.go
builder/amazonebs/builder_test.go
+0
-9
example.json
example.json
+1
-1
No files found.
builder/amazonebs/builder.go
View file @
4c37ce53
...
...
@@ -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
...
...
builder/amazonebs/builder_test.go
View file @
4c37ce53
...
...
@@ -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
)
...
...
example.json
View file @
4c37ce53
...
...
@@ -5,7 +5,7 @@
{
"type"
:
"amazon-ebs"
,
"region"
:
"us-east-1"
,
"source"
:
"ami-de0d9eb7"
"source
_ami
"
:
"ami-de0d9eb7"
}
],
...
...
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