From ac74e4f2269f0960f1f62d95a5607d0efe3e48c4 Mon Sep 17 00:00:00 2001 From: Shishir Mahajan Date: Wed, 26 Aug 2020 10:05:36 -0700 Subject: [PATCH] Error out on invalid signal. --- containerd/driver.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/containerd/driver.go b/containerd/driver.go index 4b28abe..17157d0 100644 --- a/containerd/driver.go +++ b/containerd/driver.go @@ -20,7 +20,6 @@ package containerd import ( "context" "fmt" - "os" "syscall" "time" @@ -583,13 +582,11 @@ func (d *Driver) SignalTask(taskID string, signal string) error { // The given signal will be forwarded to the target taskID. // Please checkout https://github.com/hashicorp/consul-template/blob/master/signals/signals_unix.go // for a list of supported signals. - sig := os.Interrupt - if s, ok := signals.SignalLookup[signal]; ok { - sig = s - } else { - d.logger.Warn("unknown signal to send to task, using SIGINT instead", "signal", signal, "task_id", handle.taskConfig.ID) - + sig, ok := signals.SignalLookup[signal] + if !ok { + return fmt.Errorf("Invalid signal: %s", signal) } + return handle.signal(d.ctxContainerd, sig) }