summaryrefslogtreecommitdiff
path: root/libkpod/kill.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2017-12-11 10:20:22 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-14 13:56:20 +0000
commit05f4dd9f41707959ce801f9851c79232a1b79dca (patch)
treeed4cfc80c90204f6166379f4f2c368ac57d480f1 /libkpod/kill.go
parent900afc929f01ef2a38b69263e35c964284f1f9f4 (diff)
downloadpodman-05f4dd9f41707959ce801f9851c79232a1b79dca.tar.gz
podman-05f4dd9f41707959ce801f9851c79232a1b79dca.tar.bz2
podman-05f4dd9f41707959ce801f9851c79232a1b79dca.zip
Clear up fragments of the old api
As everything is being moved over to the new container api removing files that depended on the old api Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #116 Approved by: rhatdan
Diffstat (limited to 'libkpod/kill.go')
-rw-r--r--libkpod/kill.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/libkpod/kill.go b/libkpod/kill.go
deleted file mode 100644
index 74c525818..000000000
--- a/libkpod/kill.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package libkpod
-
-import (
- "github.com/docker/docker/pkg/signal"
- "github.com/pkg/errors"
- "github.com/projectatomic/libpod/oci"
- "github.com/projectatomic/libpod/utils"
- "os"
- "syscall"
-)
-
-// Reverse lookup signal string from its map
-func findStringInSignalMap(killSignal syscall.Signal) (string, error) {
- for k, v := range signal.SignalMap {
- if v == killSignal {
- return k, nil
- }
- }
- return "", errors.Errorf("unable to convert signal to string")
-
-}
-
-// ContainerKill sends the user provided signal to the containers primary process.
-func (c *ContainerServer) ContainerKill(container string, killSignal syscall.Signal) (string, error) { // nolint
- ctr, err := c.LookupContainer(container)
- if err != nil {
- return "", errors.Wrapf(err, "failed to find container %s", container)
- }
- c.runtime.UpdateStatus(ctr)
- cStatus := c.runtime.ContainerStatus(ctr)
-
- // If the container is not running, error and move on.
- if cStatus.Status != oci.ContainerStateRunning {
- return "", errors.Errorf("cannot kill container %s: it is not running", container)
- }
- signalString, err := findStringInSignalMap(killSignal)
- if err != nil {
- return "", err
- }
- if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, c.runtime.Path(ctr), "kill", ctr.ID(), signalString); err != nil {
- return "", err
- }
- c.ContainerStateToDisk(ctr)
- return ctr.ID(), nil
-}