Commit 43962ca3 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/rpc: build updated to use new interface

parent 6a3dd16a
......@@ -29,9 +29,9 @@ func (b *build) Name() (result string) {
return
}
func (b *build) Prepare(v map[string]string) ([]string, error) {
func (b *build) Prepare() ([]string, error) {
var resp BuildPrepareResponse
if cerr := b.client.Call("Build.Prepare", v, &resp); cerr != nil {
if cerr := b.client.Call("Build.Prepare", new(interface{}), &resp); cerr != nil {
return nil, cerr
}
......@@ -86,8 +86,8 @@ func (b *BuildServer) Name(args *interface{}, reply *string) error {
return nil
}
func (b *BuildServer) Prepare(v map[string]string, resp *BuildPrepareResponse) error {
warnings, err := b.build.Prepare(v)
func (b *BuildServer) Prepare(args *interface{}, resp *BuildPrepareResponse) error {
warnings, err := b.build.Prepare()
*resp = BuildPrepareResponse{
Warnings: warnings,
Error: err,
......
......@@ -12,7 +12,6 @@ var testBuildArtifact = &packer.MockArtifact{}
type testBuild struct {
nameCalled bool
prepareCalled bool
prepareVars map[string]string
prepareWarnings []string
runCalled bool
runCache packer.Cache
......@@ -29,9 +28,8 @@ func (b *testBuild) Name() string {
return "name"
}
func (b *testBuild) Prepare(v map[string]string) ([]string, error) {
func (b *testBuild) Prepare() ([]string, error) {
b.prepareCalled = true
b.prepareVars = v
return b.prepareWarnings, nil
}
......@@ -74,19 +72,11 @@ func TestBuild(t *testing.T) {
}
// Test Prepare
bClient.Prepare(map[string]string{"foo": "bar"})
bClient.Prepare()
if !b.prepareCalled {
t.Fatal("prepare should be called")
}
if len(b.prepareVars) != 1 {
t.Fatalf("bad vars: %#v", b.prepareVars)
}
if b.prepareVars["foo"] != "bar" {
t.Fatalf("bad vars: %#v", b.prepareVars)
}
// Test Run
cache := new(testCache)
ui := new(testUi)
......@@ -144,7 +134,7 @@ func TestBuildPrepare_Warnings(t *testing.T) {
expected := []string{"foo"}
b.prepareWarnings = expected
warnings, err := bClient.Prepare(nil)
warnings, err := bClient.Prepare()
if err != nil {
t.Fatalf("err: %s", err)
}
......
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