open-nomad/client/driver/rkt.go

570 lines
18 KiB
Go
Raw Normal View History

package driver
import (
2015-10-07 22:24:16 +00:00
"bytes"
"encoding/json"
"fmt"
"log"
"net"
2016-10-07 19:37:52 +00:00
"os"
2015-10-07 22:24:16 +00:00
"os/exec"
2015-10-09 19:14:56 +00:00
"path/filepath"
2015-10-07 22:24:16 +00:00
"regexp"
"runtime"
"strconv"
2015-10-07 22:24:16 +00:00
"strings"
"syscall"
"time"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-version"
2015-10-09 19:14:56 +00:00
"github.com/hashicorp/nomad/client/allocdir"
2015-10-07 22:24:16 +00:00
"github.com/hashicorp/nomad/client/config"
"github.com/hashicorp/nomad/client/driver/executor"
dstructs "github.com/hashicorp/nomad/client/driver/structs"
cstructs "github.com/hashicorp/nomad/client/structs"
"github.com/hashicorp/nomad/helper/discover"
"github.com/hashicorp/nomad/helper/fields"
2015-10-07 22:24:16 +00:00
"github.com/hashicorp/nomad/nomad/structs"
"github.com/mitchellh/mapstructure"
)
var (
2016-02-02 23:39:45 +00:00
reRktVersion = regexp.MustCompile(`rkt [vV]ersion[:]? (\d[.\d]+)`)
reAppcVersion = regexp.MustCompile(`appc [vV]ersion[:]? (\d[.\d]+)`)
)
2015-12-22 05:15:37 +00:00
const (
2015-12-22 18:11:22 +00:00
// minRktVersion is the earliest supported version of rkt. rkt added support
// for CPU and memory isolators in 0.14.0. We cannot support an earlier
// version to maintain an uniform interface across all drivers
minRktVersion = "1.0.0"
2015-12-22 18:11:22 +00:00
// The key populated in the Node Attributes to indicate the presence of the
// Rkt driver
rktDriverAttr = "driver.rkt"
2016-10-13 23:18:18 +00:00
// rktVolumesConfigOption is the key for enabling the use of custom
// bind volumes.
rktVolumesConfigOption = "rkt.volumes.enabled"
rktVolumesConfigDefault = true
// rktCmd is the command rkt is installed as.
rktCmd = "rkt"
2015-12-22 05:15:37 +00:00
)
// RktDriver is a driver for running images via Rkt
// We attempt to chose sane defaults for now, with more configuration available
// planned in the future
type RktDriver struct {
2015-10-07 22:24:16 +00:00
DriverContext
}
2015-11-14 04:22:49 +00:00
type RktDriverConfig struct {
ImageName string `mapstructure:"image"`
Command string `mapstructure:"command"`
Args []string `mapstructure:"args"`
TrustPrefix string `mapstructure:"trust_prefix"`
DNSServers []string `mapstructure:"dns_servers"` // DNS Server for containers
DNSSearchDomains []string `mapstructure:"dns_search_domains"` // DNS Search domains for containers
Net []string `mapstructure:"net"` // Networks for the containers
PortMapRaw []map[string]string `mapstructure:"port_map"` //
PortMap map[string]string `mapstructure:"-"` // A map of host port and the port name defined in the image manifest file
Volumes []string `mapstructure:"volumes"` // Host-Volumes to mount in, syntax: /path/to/host/directory:/destination/path/in/container
Debug bool `mapstructure:"debug"` // Enable debug option for rkt command
}
// rktHandle is returned from Start/Open as a handle to the PID
type rktHandle struct {
pluginClient *plugin.Client
executorPid int
executor executor.Executor
logger *log.Logger
killTimeout time.Duration
maxKillTimeout time.Duration
waitCh chan *dstructs.WaitResult
doneCh chan struct{}
}
// rktPID is a struct to map the pid running the process to the vm image on
// disk
type rktPID struct {
PluginConfig *PluginReattachConfig
ExecutorPid int
KillTimeout time.Duration
MaxKillTimeout time.Duration
}
// NewRktDriver is used to create a new exec driver
func NewRktDriver(ctx *DriverContext) Driver {
2015-11-05 21:46:02 +00:00
return &RktDriver{DriverContext: *ctx}
}
func (d *RktDriver) FSIsolation() cstructs.FSIsolation {
return cstructs.FSIsolationImage
}
// Validate is used to validate the driver configuration
func (d *RktDriver) Validate(config map[string]interface{}) error {
fd := &fields.FieldData{
Raw: config,
Schema: map[string]*fields.FieldSchema{
"image": &fields.FieldSchema{
Type: fields.TypeString,
Required: true,
},
"command": &fields.FieldSchema{
Type: fields.TypeString,
},
"args": &fields.FieldSchema{
Type: fields.TypeArray,
},
"trust_prefix": &fields.FieldSchema{
Type: fields.TypeString,
},
"dns_servers": &fields.FieldSchema{
Type: fields.TypeArray,
},
"dns_search_domains": &fields.FieldSchema{
Type: fields.TypeArray,
},
"net": &fields.FieldSchema{
Type: fields.TypeArray,
},
"port_map": &fields.FieldSchema{
Type: fields.TypeArray,
},
2016-08-08 10:30:47 +00:00
"debug": &fields.FieldSchema{
Type: fields.TypeBool,
2016-08-08 10:30:47 +00:00
},
"volumes": &fields.FieldSchema{
Type: fields.TypeArray,
},
},
}
if err := fd.Validate(); err != nil {
return err
}
return nil
}
2016-10-19 22:06:23 +00:00
func (d *RktDriver) Abilities() DriverAbilities {
return DriverAbilities{
SendSignals: false,
}
}
func (d *RktDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error) {
// Get the current status so that we can log any debug messages only if the
// state changes
_, currentlyEnabled := node.Attributes[rktDriverAttr]
2015-10-07 22:24:16 +00:00
// Only enable if we are root when running on non-windows systems.
if runtime.GOOS != "windows" && syscall.Geteuid() != 0 {
if currentlyEnabled {
d.logger.Printf("[DEBUG] driver.rkt: must run as root user, disabling")
}
delete(node.Attributes, rktDriverAttr)
2015-10-07 22:24:16 +00:00
return false, nil
}
outBytes, err := exec.Command(rktCmd, "version").Output()
2015-10-07 22:24:16 +00:00
if err != nil {
delete(node.Attributes, rktDriverAttr)
2015-10-07 22:24:16 +00:00
return false, nil
}
out := strings.TrimSpace(string(outBytes))
rktMatches := reRktVersion.FindStringSubmatch(out)
2015-10-21 01:08:46 +00:00
appcMatches := reAppcVersion.FindStringSubmatch(out)
2015-10-07 22:24:16 +00:00
if len(rktMatches) != 2 || len(appcMatches) != 2 {
delete(node.Attributes, rktDriverAttr)
2015-10-07 22:24:16 +00:00
return false, fmt.Errorf("Unable to parse Rkt version string: %#v", rktMatches)
}
node.Attributes[rktDriverAttr] = "1"
2015-10-21 01:08:46 +00:00
node.Attributes["driver.rkt.version"] = rktMatches[1]
2015-10-07 22:24:16 +00:00
node.Attributes["driver.rkt.appc.version"] = appcMatches[1]
2015-12-22 05:15:37 +00:00
minVersion, _ := version.NewVersion(minRktVersion)
currentVersion, _ := version.NewVersion(node.Attributes["driver.rkt.version"])
if currentVersion.LessThan(minVersion) {
// Do not allow ancient rkt versions
d.logger.Printf("[WARN] driver.rkt: please upgrade rkt to a version >= %s", minVersion)
node.Attributes[rktDriverAttr] = "0"
}
// Advertise if this node supports rkt volumes
if d.config.ReadBoolDefault(rktVolumesConfigOption, rktVolumesConfigDefault) {
node.Attributes["driver."+rktVolumesConfigOption] = "1"
}
2015-10-07 22:24:16 +00:00
return true, nil
}
func (d *RktDriver) Periodic() (bool, time.Duration) {
return true, 15 * time.Second
}
func (d *RktDriver) Prestart(ctx *ExecContext, task *structs.Task) error {
return nil
}
// Run an existing Rkt image.
func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) {
2015-11-14 04:22:49 +00:00
var driverConfig RktDriverConfig
if err := mapstructure.WeakDecode(task.Config, &driverConfig); err != nil {
return nil, err
}
driverConfig.PortMap = mapMergeStrStr(driverConfig.PortMapRaw...)
// ACI image
img := driverConfig.ImageName
2015-12-22 18:23:29 +00:00
// Build the command.
var cmdArgs []string
2016-08-08 10:30:47 +00:00
// Add debug option to rkt command.
debug := driverConfig.Debug
2016-08-08 10:30:47 +00:00
2015-10-07 22:24:16 +00:00
// Add the given trust prefix
2016-08-05 17:55:20 +00:00
trustPrefix := driverConfig.TrustPrefix
insecure := false
2016-08-05 17:55:20 +00:00
if trustPrefix != "" {
var outBuf, errBuf bytes.Buffer
cmd := exec.Command(rktCmd, "trust", "--skip-fingerprint-review=true", fmt.Sprintf("--prefix=%s", trustPrefix), fmt.Sprintf("--debug=%t", debug))
cmd.Stdout = &outBuf
cmd.Stderr = &errBuf
if err := cmd.Run(); err != nil {
return nil, fmt.Errorf("Error running rkt trust: %s\n\nOutput: %s\n\nError: %s",
err, outBuf.String(), errBuf.String())
}
2015-12-21 10:10:37 +00:00
d.logger.Printf("[DEBUG] driver.rkt: added trust prefix: %q", trustPrefix)
2015-12-22 18:23:29 +00:00
} else {
// Disble signature verification if the trust command was not run.
insecure = true
}
cmdArgs = append(cmdArgs, "run")
2016-10-13 23:18:18 +00:00
// Mount /alloc
2016-10-21 22:58:35 +00:00
allocVolName := fmt.Sprintf("%s-%s-alloc", ctx.AllocID, task.Name)
cmdArgs = append(cmdArgs, fmt.Sprintf("--volume=%s,kind=host,source=%s", allocVolName, ctx.TaskDir.SharedAllocDir))
2016-10-21 22:58:35 +00:00
cmdArgs = append(cmdArgs, fmt.Sprintf("--mount=volume=%s,target=%s", allocVolName, allocdir.SharedAllocContainerPath))
2016-10-13 23:18:18 +00:00
// Mount /local
2016-10-21 22:58:35 +00:00
localVolName := fmt.Sprintf("%s-%s-local", ctx.AllocID, task.Name)
cmdArgs = append(cmdArgs, fmt.Sprintf("--volume=%s,kind=host,source=%s", localVolName, ctx.TaskDir.LocalDir))
2016-10-21 22:58:35 +00:00
cmdArgs = append(cmdArgs, fmt.Sprintf("--mount=volume=%s,target=%s", localVolName, allocdir.TaskLocalContainerPath))
2016-10-13 23:18:18 +00:00
// Mount /secrets
2016-10-21 22:58:35 +00:00
secretsVolName := fmt.Sprintf("%s-%s-secrets", ctx.AllocID, task.Name)
cmdArgs = append(cmdArgs, fmt.Sprintf("--volume=%s,kind=host,source=%s", secretsVolName, ctx.TaskDir.SecretsDir))
2016-10-21 22:58:35 +00:00
cmdArgs = append(cmdArgs, fmt.Sprintf("--mount=volume=%s,target=%s", secretsVolName, allocdir.TaskSecretsContainerPath))
2016-10-13 23:34:47 +00:00
// Mount arbitrary volumes if enabled
if len(driverConfig.Volumes) > 0 {
if enabled := d.config.ReadBoolDefault(rktVolumesConfigOption, rktVolumesConfigDefault); !enabled {
2016-10-13 23:34:47 +00:00
return nil, fmt.Errorf("%s is false; cannot use rkt volumes: %+q", rktVolumesConfigOption, driverConfig.Volumes)
}
for i, rawvol := range driverConfig.Volumes {
parts := strings.Split(rawvol, ":")
if len(parts) != 2 {
return nil, fmt.Errorf("invalid rkt volume: %q", rawvol)
}
2016-10-21 22:58:35 +00:00
volName := fmt.Sprintf("%s-%s-%d", ctx.AllocID, task.Name, i)
cmdArgs = append(cmdArgs, fmt.Sprintf("--volume=%s,kind=host,source=%s", volName, parts[0]))
cmdArgs = append(cmdArgs, fmt.Sprintf("--mount=volume=%s,target=%s", volName, parts[1]))
2016-10-13 23:34:47 +00:00
}
}
2016-10-13 23:18:18 +00:00
cmdArgs = append(cmdArgs, img)
2016-10-13 23:18:18 +00:00
if insecure {
cmdArgs = append(cmdArgs, "--insecure-options=all")
2015-10-07 22:24:16 +00:00
}
cmdArgs = append(cmdArgs, fmt.Sprintf("--debug=%t", debug))
2015-10-07 22:24:16 +00:00
2016-05-15 16:41:34 +00:00
// Inject environment variables
2016-01-11 17:58:26 +00:00
for k, v := range d.taskEnv.EnvMap() {
cmdArgs = append(cmdArgs, fmt.Sprintf("--set-env=%v=%q", k, v))
2015-10-07 22:24:16 +00:00
}
2016-05-15 16:41:34 +00:00
// Check if the user has overridden the exec command.
2016-08-05 17:55:20 +00:00
if driverConfig.Command != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--exec=%v", driverConfig.Command))
2015-10-07 22:24:16 +00:00
}
// Add memory isolator
2016-08-14 05:27:42 +00:00
cmdArgs = append(cmdArgs, fmt.Sprintf("--memory=%vM", int64(task.Resources.MemoryMB)))
// Add CPU isolator
2015-12-21 10:10:37 +00:00
cmdArgs = append(cmdArgs, fmt.Sprintf("--cpu=%vm", int64(task.Resources.CPU)))
// Add DNS servers
if len(driverConfig.DNSServers) == 1 && (driverConfig.DNSServers[0] == "host" || driverConfig.DNSServers[0] == "none") {
// Special case single item lists with the special values "host" or "none"
cmdArgs = append(cmdArgs, fmt.Sprintf("--dns=%s", driverConfig.DNSServers[0]))
} else {
for _, ip := range driverConfig.DNSServers {
if err := net.ParseIP(ip); err == nil {
msg := fmt.Errorf("invalid ip address for container dns server %q", ip)
d.logger.Printf("[DEBUG] driver.rkt: %v", msg)
return nil, msg
} else {
cmdArgs = append(cmdArgs, fmt.Sprintf("--dns=%s", ip))
}
}
}
// set DNS search domains
for _, domain := range driverConfig.DNSSearchDomains {
cmdArgs = append(cmdArgs, fmt.Sprintf("--dns-search=%s", domain))
}
// set network
network := strings.Join(driverConfig.Net, ",")
if network != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--net=%s", network))
}
// Setup port mapping and exposed ports
if len(task.Resources.Networks) == 0 {
d.logger.Println("[DEBUG] driver.rkt: No network interfaces are available")
if len(driverConfig.PortMap) > 0 {
return nil, fmt.Errorf("Trying to map ports but no network interface is available")
}
} else {
// TODO add support for more than one network
network := task.Resources.Networks[0]
for _, port := range network.ReservedPorts {
var containerPort string
2016-10-25 23:27:35 +00:00
mapped, ok := driverConfig.PortMap[port.Label]
if !ok {
// If the user doesn't have a mapped port using port_map, driver stops running container.
return nil, fmt.Errorf("port_map is not set. When you defined port in the resources, you need to configure port_map.")
}
2016-10-25 23:27:35 +00:00
containerPort = mapped
hostPortStr := strconv.Itoa(port.Value)
d.logger.Printf("[DEBUG] driver.rkt: exposed port %s", containerPort)
// Add port option to rkt run arguments. rkt allows multiple port args
cmdArgs = append(cmdArgs, fmt.Sprintf("--port=%s:%s", containerPort, hostPortStr))
}
for _, port := range network.DynamicPorts {
// By default we will map the allocated port 1:1 to the container
var containerPort string
if mapped, ok := driverConfig.PortMap[port.Label]; ok {
containerPort = mapped
} else {
// If the user doesn't have mapped a port using port_map, driver stops running container.
return nil, fmt.Errorf("port_map is not set. When you defined port in the resources, you need to configure port_map.")
}
hostPortStr := strconv.Itoa(port.Value)
d.logger.Printf("[DEBUG] driver.rkt: exposed port %s", containerPort)
// Add port option to rkt run arguments. rkt allows multiple port args
cmdArgs = append(cmdArgs, fmt.Sprintf("--port=%s:%s", containerPort, hostPortStr))
}
}
// Add user passed arguments.
if len(driverConfig.Args) != 0 {
2016-01-11 17:58:26 +00:00
parsed := d.taskEnv.ParseAndReplace(driverConfig.Args)
// Need to start arguments with "--"
if len(parsed) > 0 {
2015-12-21 10:10:37 +00:00
cmdArgs = append(cmdArgs, "--")
}
for _, arg := range parsed {
2015-12-21 10:10:37 +00:00
cmdArgs = append(cmdArgs, fmt.Sprintf("%v", arg))
}
2015-10-07 22:24:16 +00:00
}
// Set the host environment variables.
filter := strings.Split(d.config.ReadDefault("env.blacklist", config.DefaultEnvBlacklist), ",")
d.taskEnv.AppendHostEnvvars(filter)
bin, err := discover.NomadExecutable()
2015-10-09 19:14:56 +00:00
if err != nil {
return nil, fmt.Errorf("unable to find the nomad binary: %v", err)
2015-10-09 19:14:56 +00:00
}
pluginLogFile := filepath.Join(ctx.TaskDir.Dir, fmt.Sprintf("%s-executor.out", task.Name))
pluginConfig := &plugin.ClientConfig{
2017-01-09 19:21:51 +00:00
Cmd: exec.Command(bin, "executor", pluginLogFile, ctx.LogLevel),
2015-10-09 19:14:56 +00:00
}
2016-03-16 03:21:52 +00:00
execIntf, pluginClient, err := createExecutor(pluginConfig, d.config.LogOutput, d.config)
if err != nil {
return nil, err
}
executorCtx := &executor.ExecutorContext{
TaskEnv: d.taskEnv,
Driver: "rkt",
AllocID: ctx.AllocID,
Task: task,
TaskDir: ctx.TaskDir.Dir,
LogDir: ctx.TaskDir.LogDir,
}
2016-10-12 18:35:29 +00:00
if err := execIntf.SetContext(executorCtx); err != nil {
pluginClient.Kill()
return nil, fmt.Errorf("failed to set executor context: %v", err)
}
2015-10-09 19:14:56 +00:00
absPath, err := GetAbsolutePath(rktCmd)
2016-03-16 02:22:40 +00:00
if err != nil {
return nil, err
}
2016-10-12 18:35:29 +00:00
execCmd := &executor.ExecCommand{
Cmd: absPath,
Args: cmdArgs,
User: task.User,
2016-10-12 18:35:29 +00:00
}
ps, err := execIntf.LaunchCmd(execCmd)
if err != nil {
pluginClient.Kill()
2016-03-19 19:18:10 +00:00
return nil, err
2015-10-07 22:24:16 +00:00
}
d.logger.Printf("[DEBUG] driver.rkt: started ACI %q with: %v", img, cmdArgs)
maxKill := d.DriverContext.config.MaxKillTimeout
2015-10-07 22:24:16 +00:00
h := &rktHandle{
pluginClient: pluginClient,
2016-03-16 03:21:52 +00:00
executor: execIntf,
executorPid: ps.Pid,
logger: d.logger,
killTimeout: GetKillTimeout(task.KillTimeout, maxKill),
maxKillTimeout: maxKill,
doneCh: make(chan struct{}),
waitCh: make(chan *dstructs.WaitResult, 1),
2015-10-07 22:24:16 +00:00
}
if err := h.executor.SyncServices(consulContext(d.config, "")); err != nil {
2016-03-24 21:53:53 +00:00
h.logger.Printf("[ERR] driver.rkt: error registering services for task: %q: %v", task.Name, err)
2016-03-23 20:19:45 +00:00
}
2015-10-07 22:24:16 +00:00
go h.run()
return h, nil
}
func (d *RktDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error) {
2015-10-07 22:24:16 +00:00
// Parse the handle
pidBytes := []byte(strings.TrimPrefix(handleID, "Rkt:"))
id := &rktPID{}
if err := json.Unmarshal(pidBytes, id); err != nil {
2015-10-07 22:24:16 +00:00
return nil, fmt.Errorf("failed to parse Rkt handle '%s': %v", handleID, err)
}
pluginConfig := &plugin.ClientConfig{
Reattach: id.PluginConfig.PluginConfig(),
}
2016-03-29 23:27:31 +00:00
exec, pluginClient, err := createExecutor(pluginConfig, d.config.LogOutput, d.config)
if err != nil {
d.logger.Println("[ERROR] driver.rkt: error connecting to plugin so destroying plugin pid and user pid")
if e := destroyPlugin(id.PluginConfig.Pid, id.ExecutorPid); e != nil {
d.logger.Printf("[ERROR] driver.rkt: error destroying plugin and executor pid: %v", e)
}
return nil, fmt.Errorf("error connecting to plugin: %v", err)
2015-10-07 22:24:16 +00:00
}
2016-03-30 05:05:02 +00:00
ver, _ := exec.Version()
d.logger.Printf("[DEBUG] driver.rkt: version of executor: %v", ver.Version)
2015-10-07 22:24:16 +00:00
// Return a driver handle
h := &rktHandle{
pluginClient: pluginClient,
executorPid: id.ExecutorPid,
2016-03-29 23:27:31 +00:00
executor: exec,
logger: d.logger,
killTimeout: id.KillTimeout,
maxKillTimeout: id.MaxKillTimeout,
doneCh: make(chan struct{}),
waitCh: make(chan *dstructs.WaitResult, 1),
2015-10-07 22:24:16 +00:00
}
if err := h.executor.SyncServices(consulContext(d.config, "")); err != nil {
2016-03-24 22:39:10 +00:00
h.logger.Printf("[ERR] driver.rkt: error registering services: %v", err)
}
2015-10-07 22:24:16 +00:00
go h.run()
return h, nil
}
func (h *rktHandle) ID() string {
2015-10-07 22:24:16 +00:00
// Return a handle to the PID
pid := &rktPID{
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
KillTimeout: h.killTimeout,
MaxKillTimeout: h.maxKillTimeout,
ExecutorPid: h.executorPid,
2015-10-07 22:24:16 +00:00
}
data, err := json.Marshal(pid)
if err != nil {
h.logger.Printf("[ERR] driver.rkt: failed to marshal rkt PID to JSON: %s", err)
}
return fmt.Sprintf("Rkt:%s", string(data))
}
func (h *rktHandle) WaitCh() chan *dstructs.WaitResult {
2015-10-07 22:24:16 +00:00
return h.waitCh
}
func (h *rktHandle) Update(task *structs.Task) error {
// Store the updated kill timeout.
h.killTimeout = GetKillTimeout(task.KillTimeout, h.maxKillTimeout)
h.executor.UpdateTask(task)
2015-10-07 22:24:16 +00:00
// Update is not possible
return nil
}
2016-10-07 19:37:52 +00:00
func (h *rktHandle) Signal(s os.Signal) error {
2016-10-07 23:49:00 +00:00
return fmt.Errorf("Rkt does not support signals")
2016-10-07 19:37:52 +00:00
}
// Kill is used to terminate the task. We send an Interrupt
// and then provide a 5 second grace period before doing a Kill.
func (h *rktHandle) Kill() error {
h.executor.ShutDown()
2015-10-07 22:24:16 +00:00
select {
case <-h.doneCh:
return nil
case <-time.After(h.killTimeout):
return h.executor.Exit()
2015-10-07 22:24:16 +00:00
}
}
2016-04-28 23:06:01 +00:00
func (h *rktHandle) Stats() (*cstructs.TaskResourceUsage, error) {
return nil, DriverStatsNotImplemented
2016-04-28 23:06:01 +00:00
}
func (h *rktHandle) run() {
ps, werr := h.executor.Wait()
2015-10-07 22:24:16 +00:00
close(h.doneCh)
if ps.ExitCode == 0 && werr != nil {
if e := killProcess(h.executorPid); e != nil {
h.logger.Printf("[ERROR] driver.rkt: error killing user process: %v", e)
}
}
2016-03-23 20:19:45 +00:00
// Remove services
if err := h.executor.DeregisterServices(); err != nil {
h.logger.Printf("[ERR] driver.rkt: failed to deregister services: %v", err)
}
// Exit the executor
if err := h.executor.Exit(); err != nil {
h.logger.Printf("[ERR] driver.rkt: error killing executor: %v", err)
}
h.pluginClient.Kill()
// Send the results
h.waitCh <- dstructs.NewWaitResult(ps.ExitCode, 0, werr)
close(h.waitCh)
}