From 58e8d9ac56bc74efdb929e2a8aca58f5f769e625 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 2 Nov 2013 22:51:26 -0500 Subject: [PATCH] packer/plugin: new Builder interface --- packer/plugin/builder.go | 2 +- packer/plugin/builder_test.go | 13 ------------- packer/plugin/plugin_test.go | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/packer/plugin/builder.go b/packer/plugin/builder.go index b8999ff94..a0a89d57b 100644 --- a/packer/plugin/builder.go +++ b/packer/plugin/builder.go @@ -10,7 +10,7 @@ type cmdBuilder struct { client *Client } -func (b *cmdBuilder) Prepare(config ...interface{}) error { +func (b *cmdBuilder) Prepare(config ...interface{}) ([]string, error) { defer func() { r := recover() b.checkExit(r, nil) diff --git a/packer/plugin/builder_test.go b/packer/plugin/builder_test.go index e3356f50f..23a80999f 100644 --- a/packer/plugin/builder_test.go +++ b/packer/plugin/builder_test.go @@ -1,23 +1,10 @@ package plugin import ( - "github.com/mitchellh/packer/packer" "os/exec" "testing" ) -type helperBuilder byte - -func (helperBuilder) Prepare(...interface{}) error { - return nil -} - -func (helperBuilder) Run(packer.Ui, packer.Hook, packer.Cache) (packer.Artifact, error) { - return nil, nil -} - -func (helperBuilder) Cancel() {} - func TestBuilder_NoExist(t *testing.T) { c := NewClient(&ClientConfig{Cmd: exec.Command("i-should-not-exist")}) defer c.Kill() diff --git a/packer/plugin/plugin_test.go b/packer/plugin/plugin_test.go index 10c3f9d5c..d80aceaf7 100644 --- a/packer/plugin/plugin_test.go +++ b/packer/plugin/plugin_test.go @@ -54,7 +54,7 @@ func TestHelperProcess(*testing.T) { fmt.Printf("%s1|:1234\n", APIVersion) <-make(chan int) case "builder": - ServeBuilder(new(helperBuilder)) + ServeBuilder(new(packer.MockBuilder)) case "command": ServeCommand(new(helperCommand)) case "hook":