packer/rpc: Get RPC compliant with Environment again
This commit is contained in:
parent
d95f0a620a
commit
9c89e33b5b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue