diff options
author | Brent Baude <bbaude@redhat.com> | 2020-04-16 12:25:26 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-04-16 15:53:58 -0500 |
commit | 241326a9a8c20ad7f2bcf651416b836e7778e090 (patch) | |
tree | 4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podman/kill.go | |
parent | 88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff) | |
download | podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.gz podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.bz2 podman-241326a9a8c20ad7f2bcf651416b836e7778e090.zip |
Podman V2 birth
remote podman v1 and replace with podman v2.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/kill.go')
-rw-r--r-- | cmd/podman/kill.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go deleted file mode 100644 index a10546ea9..000000000 --- a/cmd/podman/kill.go +++ /dev/null @@ -1,73 +0,0 @@ -package main - -import ( - "github.com/containers/libpod/cmd/podman/cliconfig" - "github.com/containers/libpod/pkg/adapter" - "github.com/containers/libpod/pkg/util" - "github.com/opentracing/opentracing-go" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -var ( - killCommand cliconfig.KillValues - - killDescription = "The main process inside each container specified will be sent SIGKILL, or any signal specified with option --signal." - _killCommand = &cobra.Command{ - Use: "kill [flags] CONTAINER [CONTAINER...]", - Short: "Kill one or more running containers with a specific signal", - Long: killDescription, - RunE: func(cmd *cobra.Command, args []string) error { - killCommand.InputArgs = args - killCommand.GlobalFlags = MainGlobalOpts - killCommand.Remote = remoteclient - return killCmd(&killCommand) - }, - Args: func(cmd *cobra.Command, args []string) error { - return checkAllLatestAndCIDFile(cmd, args, false, false) - }, - Example: `podman kill mywebserver - podman kill 860a4b23 - podman kill --signal TERM ctrID`, - } -) - -func init() { - killCommand.Command = _killCommand - killCommand.SetHelpTemplate(HelpTemplate()) - killCommand.SetUsageTemplate(UsageTemplate()) - flags := killCommand.Flags() - - flags.BoolVarP(&killCommand.All, "all", "a", false, "Signal all running containers") - flags.StringVarP(&killCommand.Signal, "signal", "s", "KILL", "Signal to send to the container") - flags.BoolVarP(&killCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") - - markFlagHiddenForRemoteClient("latest", flags) -} - -// killCmd kills one or more containers with a signal -func killCmd(c *cliconfig.KillValues) error { - if c.Bool("trace") { - span, _ := opentracing.StartSpanFromContext(Ctx, "killCmd") - defer span.Finish() - } - - // Check if the signalString provided by the user is valid - // Invalid signals will return err - killSignal, err := util.ParseSignal(c.Signal) - if err != nil { - return err - } - - runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand) - if err != nil { - return errors.Wrapf(err, "could not get runtime") - } - defer runtime.DeferredShutdown(false) - - ok, failures, err := runtime.KillContainers(getContext(), c, killSignal) - if err != nil { - return err - } - return printCmdResults(ok, failures) -} |