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
d926b987
Commit
d926b987
authored
May 11, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update all packer/rpc, packer/plugin, builders for new builder API
parent
441edd25
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
builder/amazonebs/builder.go
builder/amazonebs/builder.go
+1
-1
packer/plugin/builder.go
packer/plugin/builder.go
+2
-2
packer/plugin/builder_test.go
packer/plugin/builder_test.go
+1
-1
packer/rpc/builder.go
packer/rpc/builder.go
+4
-4
packer/rpc/builder_test.go
packer/rpc/builder_test.go
+7
-7
No files found.
builder/amazonebs/builder.go
View file @
d926b987
...
...
@@ -48,7 +48,7 @@ func (b *Builder) Prepare(raw interface{}) (err error) {
return
}
func
(
b
*
Builder
)
Run
(
build
packer
.
Build
,
ui
packer
.
Ui
)
{
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
)
{
auth
:=
aws
.
Auth
{
b
.
config
.
AccessKey
,
b
.
config
.
SecretKey
}
region
:=
aws
.
Regions
[
b
.
config
.
Region
]
ec2conn
:=
ec2
.
New
(
auth
,
region
)
...
...
packer/plugin/builder.go
View file @
d926b987
...
...
@@ -22,13 +22,13 @@ func (b *cmdBuilder) Prepare(config interface{}) error {
return
b
.
builder
.
Prepare
(
config
)
}
func
(
b
*
cmdBuilder
)
Run
(
build
packer
.
Build
,
ui
packer
.
Ui
)
{
func
(
b
*
cmdBuilder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
)
{
defer
func
()
{
r
:=
recover
()
b
.
checkExit
(
r
,
nil
)
}()
b
.
builder
.
Run
(
build
,
ui
)
b
.
builder
.
Run
(
ui
,
hook
)
}
func
(
c
*
cmdBuilder
)
checkExit
(
p
interface
{},
cb
func
())
{
...
...
packer/plugin/builder_test.go
View file @
d926b987
...
...
@@ -13,7 +13,7 @@ func (helperBuilder) Prepare(interface{}) error {
return
nil
}
func
(
helperBuilder
)
Run
(
packer
.
Build
,
packer
.
Ui
)
{}
func
(
helperBuilder
)
Run
(
packer
.
Ui
,
packer
.
Hook
)
{}
func
TestBuilder_NoExist
(
t
*
testing
.
T
)
{
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
...
...
packer/rpc/builder.go
View file @
d926b987
...
...
@@ -38,12 +38,12 @@ func (b *builder) Prepare(config interface{}) (err error) {
return
}
func
(
b
*
builder
)
Run
(
build
packer
.
Build
,
ui
packer
.
Ui
)
{
func
(
b
*
builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
)
{
// Create and start the server for the Build and UI
// TODO: Error handling
server
:=
rpc
.
NewServer
()
RegisterBuild
(
server
,
build
)
RegisterUi
(
server
,
ui
)
RegisterHook
(
server
,
hook
)
args
:=
&
BuilderRunArgs
{
serveSingleConn
(
server
)}
b
.
client
.
Call
(
"Builder.Run"
,
args
,
new
(
interface
{}))
...
...
@@ -64,9 +64,9 @@ func (b *BuilderServer) Run(args *BuilderRunArgs, reply *interface{}) error {
return
err
}
build
:=
&
Build
{
client
}
hook
:=
Hook
(
client
)
ui
:=
&
Ui
{
client
}
b
.
builder
.
Run
(
build
,
ui
)
b
.
builder
.
Run
(
ui
,
hook
)
*
reply
=
nil
return
nil
...
...
packer/rpc/builder_test.go
View file @
d926b987
...
...
@@ -11,7 +11,7 @@ type testBuilder struct {
prepareCalled
bool
prepareConfig
interface
{}
runCalled
bool
run
Build
packer
.
Build
run
Hook
packer
.
Hook
runUi
packer
.
Ui
}
...
...
@@ -21,9 +21,9 @@ func (b *testBuilder) Prepare(config interface{}) error {
return
nil
}
func
(
b
*
testBuilder
)
Run
(
build
packer
.
Build
,
ui
packer
.
Ui
)
{
func
(
b
*
testBuilder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
)
{
b
.
runCalled
=
true
b
.
run
Build
=
build
b
.
run
Hook
=
hook
b
.
runUi
=
ui
}
...
...
@@ -50,14 +50,14 @@ func TestBuilderRPC(t *testing.T) {
assert
.
Equal
(
b
.
prepareConfig
,
42
,
"prepare should be called with right arg"
)
// Test Run
build
:=
&
testBuild
{}
hook
:=
&
testHook
{}
ui
:=
&
testUi
{}
bClient
.
Run
(
build
,
ui
)
bClient
.
Run
(
ui
,
hook
)
assert
.
True
(
b
.
runCalled
,
"runs hould be called"
)
if
b
.
runCalled
{
b
.
run
Build
.
Prepare
(
)
assert
.
True
(
build
.
prepareCalled
,
"prepare
should be called"
)
b
.
run
Hook
.
Run
(
"foo"
,
nil
,
nil
)
assert
.
True
(
hook
.
runCalled
,
"run
should be called"
)
b
.
runUi
.
Say
(
"format"
)
assert
.
True
(
ui
.
sayCalled
,
"say should be called"
)
...
...
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