Commit 9c89e33b authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/rpc: Get RPC compliant with Environment again

parent d95f0a62
......@@ -73,6 +73,22 @@ func (e *Environment) Hook(name string) (h packer.Hook, err error) {
return
}
func (e *Environment) PostProcessor(name string) (p packer.PostProcessor, err error) {
var reply string
err = e.client.Call("Environment.PostProcessor", name, &reply)
if err != nil {
return
}
_, err = rpc.Dial("tcp", reply)
if err != nil {
return
}
p = nil
return
}
func (e *Environment) Provisioner(name string) (p packer.Provisioner, err error) {
var reply string
err = e.client.Call("Environment.Provisioner", name, &reply)
......@@ -143,6 +159,18 @@ func (e *EnvironmentServer) Hook(name *string, reply *string) error {
return nil
}
func (e *EnvironmentServer) PostProcessor(name *string, reply *string) error {
_, err := e.env.PostProcessor(*name)
if err != nil {
return err
}
server := rpc.NewServer()
*reply = serveSingleConn(server)
return nil
}
func (e *EnvironmentServer) Provisioner(name *string, reply *string) error {
prov, err := e.env.Provisioner(*name)
if err != nil {
......
......@@ -18,6 +18,8 @@ type testEnvironment struct {
cliArgs []string
hookCalled bool
hookName string
ppCalled bool
ppName string
provCalled bool
provName string
uiCalled bool
......@@ -45,6 +47,12 @@ func (e *testEnvironment) Hook(name string) (packer.Hook, error) {
return nil, nil
}
func (e *testEnvironment) PostProcessor(name string) (packer.PostProcessor, error) {
e.ppCalled = true
e.ppName = name
return nil, nil
}
func (e *testEnvironment) Provisioner(name string) (packer.Provisioner, error) {
e.provCalled = true
e.provName = name
......
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