Update go-plugin

This commit is contained in:
Alex Dadgar 2016-02-12 12:16:56 -08:00
parent 0b35416593
commit 18da7eea95
8 changed files with 19 additions and 20 deletions

2
Godeps/Godeps.json generated
View File

@ -159,7 +159,7 @@
},
{
"ImportPath": "github.com/hashicorp/go-plugin",
"Rev": "cc3c5ac3d07e36800f72045831637635dd1751e6"
"Rev": "cccb4a1328abbb89898f3ecf4311a05bddc4de6d"
},
{
"ImportPath": "github.com/hashicorp/go-syslog",

View File

@ -514,7 +514,6 @@ func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle
if err != nil {
return nil, fmt.Errorf("failed to start syslog collector: %v", err)
}
d.logger.Printf("Started the syslog server at %v", ss.Addr)
config, err := d.createContainer(ctx, task, &driverConfig, ss.Addr)
if err != nil {

View File

@ -139,7 +139,7 @@ func CleanupClients() {
}(client)
}
log.Println("[DEBUG] waiting for all plugin processes to complete...")
log.Println("[DEBUG] plugin: waiting for all plugin processes to complete...")
wg.Wait()
}
@ -302,7 +302,7 @@ func (c *Client) Start() (addr net.Addr, err error) {
pidWait(pid)
// Log so we can see it
log.Printf("[DEBUG] reattached plugin process exited\n")
log.Printf("[DEBUG] plugin: reattached plugin process exited\n")
// Mark it
c.l.Lock()
@ -336,7 +336,7 @@ func (c *Client) Start() (addr net.Addr, err error) {
cmd.Stderr = stderr_w
cmd.Stdout = stdout_w
log.Printf("[DEBUG] Starting plugin: %s %#v", cmd.Path, cmd.Args)
log.Printf("[DEBUG] plugin: starting plugin: %s %#v", cmd.Path, cmd.Args)
err = cmd.Start()
if err != nil {
return
@ -370,7 +370,7 @@ func (c *Client) Start() (addr net.Addr, err error) {
cmd.Wait()
// Log and make sure to flush the logs write away
log.Printf("[DEBUG] %s: plugin process exited\n", cmd.Path)
log.Printf("[DEBUG] plugin: %s: plugin process exited\n", cmd.Path)
os.Stderr.Sync()
// Mark that we exited
@ -417,7 +417,7 @@ func (c *Client) Start() (addr net.Addr, err error) {
timeout := time.After(c.config.StartTimeout)
// Start looking for the address
log.Printf("[DEBUG] Waiting for RPC address for: %s", cmd.Path)
log.Printf("[DEBUG] plugin: waiting for RPC address for: %s", cmd.Path)
select {
case <-timeout:
err = errors.New("timeout while waiting for plugin to start")
@ -520,7 +520,7 @@ func (c *Client) logStderr(r io.Reader) {
c.config.Stderr.Write([]byte(line))
line = strings.TrimRightFunc(line, unicode.IsSpace)
log.Printf("[DEBUG] %s: %s", filepath.Base(c.config.Cmd.Path), line)
log.Printf("[DEBUG] plugin: %s: %s", filepath.Base(c.config.Cmd.Path), line)
}
if err == io.EOF {

View File

@ -80,7 +80,7 @@ func (m *MuxBroker) Accept(id uint32) (net.Conn, error) {
func (m *MuxBroker) AcceptAndServe(id uint32, v interface{}) {
conn, err := m.Accept(id)
if err != nil {
log.Printf("[ERR] Plugin acceptAndServe: %s", err)
log.Printf("[ERR] plugin: plugin acceptAndServe error: %s", err)
return
}

View File

@ -1,3 +1,5 @@
// +build !windows
package plugin
import (

View File

@ -1,7 +1,6 @@
package plugin
import (
"os"
"syscall"
)
@ -22,8 +21,7 @@ func _pidAlive(pid int) bool {
}
var ec uint32
e = syscall.GetExitCodeProcess(h, &ec)
if e != nil {
if e := syscall.GetExitCodeProcess(h, &ec); e != nil {
return false
}

View File

@ -31,7 +31,7 @@ func (s *RPCServer) Accept(lis net.Listener) {
for {
conn, err := lis.Accept()
if err != nil {
log.Printf("[ERR] plugin server: %s", err)
log.Printf("[ERR] plugin: plugin server: %s", err)
return
}
@ -47,7 +47,7 @@ func (s *RPCServer) ServeConn(conn io.ReadWriteCloser) {
mux, err := yamux.Server(conn, nil)
if err != nil {
conn.Close()
log.Printf("[ERR] plugin: %s", err)
log.Printf("[ERR] plugin: error creating yamux server: %s", err)
return
}
@ -56,7 +56,7 @@ func (s *RPCServer) ServeConn(conn io.ReadWriteCloser) {
if err != nil {
mux.Close()
if err != io.EOF {
log.Printf("[ERR] plugin: %s", err)
log.Printf("[ERR] plugin: error accepting control connection: %s", err)
}
return
@ -122,7 +122,7 @@ func (d *dispenseServer) Dispense(
go func() {
conn, err := d.broker.Accept(id)
if err != nil {
log.Printf("[ERR] Plugin dispense %s: %s", name, err)
log.Printf("[ERR] go-plugin: plugin dispense error: %s: %s", name, err)
return
}
@ -135,7 +135,7 @@ func (d *dispenseServer) Dispense(
func serve(conn io.ReadWriteCloser, name string, v interface{}) {
server := rpc.NewServer()
if err := server.RegisterName(name, v); err != nil {
log.Printf("[ERR] Plugin dispense: %s", err)
log.Printf("[ERR] go-plugin: plugin dispense error: %s", err)
return
}

View File

@ -93,7 +93,7 @@ func Serve(opts *ServeConfig) {
// Register a listener so we can accept a connection
listener, err := serverListener()
if err != nil {
log.Printf("[ERR] plugin init: %s", err)
log.Printf("[ERR] plugin: plugin init: %s", err)
return
}
defer listener.Close()
@ -106,7 +106,7 @@ func Serve(opts *ServeConfig) {
}
// Output the address and service name to stdout so that core can bring it up.
log.Printf("Plugin address: %s %s\n",
log.Printf("[DEBUG] plugin: plugin address: %s %s\n",
listener.Addr().Network(), listener.Addr().String())
fmt.Printf("%d|%d|%s|%s\n",
CoreProtocolVersion,
@ -124,7 +124,7 @@ func Serve(opts *ServeConfig) {
<-ch
newCount := atomic.AddInt32(&count, 1)
log.Printf(
"Received interrupt signal (count: %d). Ignoring.",
"[DEBUG] plugin: received interrupt signal (count: %d). Ignoring.",
newCount)
}
}()