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