From 43962ca31f0566e6cbc67fb015dbe3e528f4fc71 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 27 Dec 2013 09:19:11 -0700 Subject: [PATCH] packer/rpc: build updated to use new interface --- packer/rpc/build.go | 8 ++++---- packer/rpc/build_test.go | 16 +++------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/packer/rpc/build.go b/packer/rpc/build.go index 3bb25e8af..78a3a618a 100644 --- a/packer/rpc/build.go +++ b/packer/rpc/build.go @@ -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, diff --git a/packer/rpc/build_test.go b/packer/rpc/build_test.go index 6c18ad384..d2f058e7d 100644 --- a/packer/rpc/build_test.go +++ b/packer/rpc/build_test.go @@ -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) }