open-nomad/drivers/docker/docklog/client.go
Mahmood Ali df2b579c6b driver/docker: collect tty container logs
Fixes https://github.com/hashicorp/nomad/issues/5475

When container is a tty container, we need to get raw terminal output
without any additional processing.
2019-04-24 22:01:51 -04:00

37 lines
908 B
Go

package docklog
import (
"context"
"github.com/hashicorp/nomad/drivers/docker/docklog/proto"
)
// dockerLoggerClient implements the dockerLogger interface for client side requests
type dockerLoggerClient struct {
client proto.DockerLoggerClient
}
// Start proxies the Start client side func to the protobuf interface
func (c *dockerLoggerClient) Start(opts *StartOpts) error {
req := &proto.StartRequest{
Endpoint: opts.Endpoint,
ContainerId: opts.ContainerID,
StdoutFifo: opts.Stdout,
StderrFifo: opts.Stderr,
Tty: opts.TTY,
TlsCert: opts.TLSCert,
TlsKey: opts.TLSKey,
TlsCa: opts.TLSCA,
}
_, err := c.client.Start(context.Background(), req)
return err
}
// Stop proxies the Stop client side func to the protobuf interface
func (c *dockerLoggerClient) Stop() error {
req := &proto.StopRequest{}
_, err := c.client.Stop(context.Background(), req)
return err
}