summaryrefslogtreecommitdiff
path: root/cmd/podman/cleanup.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-04-16 12:25:26 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-16 15:53:58 -0500
commit241326a9a8c20ad7f2bcf651416b836e7778e090 (patch)
tree4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podman/cleanup.go
parent88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff)
downloadpodman-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/cleanup.go')
-rw-r--r--cmd/podman/cleanup.go64
1 files changed, 0 insertions, 64 deletions
diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go
deleted file mode 100644
index 80a19b000..000000000
--- a/cmd/podman/cleanup.go
+++ /dev/null
@@ -1,64 +0,0 @@
-//+build !remoteclient
-
-package main
-
-import (
- "github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/pkg/adapter"
- "github.com/pkg/errors"
- "github.com/spf13/cobra"
-)
-
-var (
- cleanupCommand cliconfig.CleanupValues
- cleanupDescription = `
- podman container cleanup
-
- Cleans up mount points and network stacks on one or more containers from the host. The container name or ID can be used. This command is used internally when running containers, but can also be used if container cleanup has failed when a container exits.
-`
- _cleanupCommand = &cobra.Command{
- Use: "cleanup [flags] CONTAINER [CONTAINER...]",
- Short: "Cleanup network and mountpoints of one or more containers",
- Long: cleanupDescription,
- RunE: func(cmd *cobra.Command, args []string) error {
- cleanupCommand.InputArgs = args
- cleanupCommand.GlobalFlags = MainGlobalOpts
- cleanupCommand.Remote = remoteclient
- return cleanupCmd(&cleanupCommand)
- },
- Args: func(cmd *cobra.Command, args []string) error {
- return checkAllLatestAndCIDFile(cmd, args, false, false)
- },
- Example: `podman container cleanup --latest
- podman container cleanup ctrID1 ctrID2 ctrID3
- podman container cleanup --all`,
- }
-)
-
-func init() {
- cleanupCommand.Command = _cleanupCommand
- cleanupCommand.SetHelpTemplate(HelpTemplate())
- cleanupCommand.SetUsageTemplate(UsageTemplate())
- flags := cleanupCommand.Flags()
-
- flags.BoolVarP(&cleanupCommand.All, "all", "a", false, "Cleans up all containers")
- flags.BoolVarP(&cleanupCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
- flags.BoolVar(&cleanupCommand.Remove, "rm", false, "After cleanup, remove the container entirely")
- flags.BoolVar(&cleanupCommand.RemoveImage, "rmi", false, "After cleanup, remove the image entirely")
- markFlagHiddenForRemoteClient("latest", flags)
-}
-
-func cleanupCmd(c *cliconfig.CleanupValues) error {
- 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.CleanupContainers(getContext(), c)
- if err != nil {
- return err
- }
-
- return printCmdResults(ok, failures)
-}