summaryrefslogtreecommitdiff
path: root/cmd/podman/pod_inspect.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-16 14:04:58 -0700
committerGitHub <noreply@github.com>2020-04-16 14:04:58 -0700
commit0d2b5532c417c58bd24e71a56c5c55b43e423a59 (patch)
tree4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podman/pod_inspect.go
parent88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff)
parent241326a9a8c20ad7f2bcf651416b836e7778e090 (diff)
downloadpodman-0d2b5532c417c58bd24e71a56c5c55b43e423a59.tar.gz
podman-0d2b5532c417c58bd24e71a56c5c55b43e423a59.tar.bz2
podman-0d2b5532c417c58bd24e71a56c5c55b43e423a59.zip
Merge pull request #5852 from baude/v1prune
Podman V2 birth
Diffstat (limited to 'cmd/podman/pod_inspect.go')
-rw-r--r--cmd/podman/pod_inspect.go80
1 files changed, 0 insertions, 80 deletions
diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go
deleted file mode 100644
index 03b5a8cc4..000000000
--- a/cmd/podman/pod_inspect.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/pkg/adapter"
- "github.com/pkg/errors"
- "github.com/spf13/cobra"
-)
-
-var (
- podInspectCommand cliconfig.PodInspectValues
- podInspectDescription = `Display the configuration for a pod by name or id
-
- By default, this will render all results in a JSON array.`
-
- _podInspectCommand = &cobra.Command{
- Use: "inspect [flags] POD",
- Short: "Displays a pod configuration",
- Long: podInspectDescription,
- RunE: func(cmd *cobra.Command, args []string) error {
- podInspectCommand.InputArgs = args
- podInspectCommand.GlobalFlags = MainGlobalOpts
- podInspectCommand.Remote = remoteclient
- return podInspectCmd(&podInspectCommand)
- },
- Example: `podman pod inspect podID`,
- }
-)
-
-func init() {
- podInspectCommand.Command = _podInspectCommand
- podInspectCommand.SetHelpTemplate(HelpTemplate())
- podInspectCommand.SetUsageTemplate(UsageTemplate())
- flags := podInspectCommand.Flags()
- flags.BoolVarP(&podInspectCommand.Latest, "latest", "l", false, "Act on the latest pod podman is aware of")
-
- markFlagHiddenForRemoteClient("latest", flags)
-}
-
-func podInspectCmd(c *cliconfig.PodInspectValues) error {
- var (
- pod *adapter.Pod
- )
- args := c.InputArgs
-
- if len(args) < 1 && !c.Latest {
- return errors.Errorf("you must provide the name or id of a pod")
- }
-
- runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
- if err != nil {
- return errors.Wrapf(err, "could not get runtime")
- }
- defer runtime.DeferredShutdown(false)
-
- if c.Latest {
- pod, err = runtime.GetLatestPod()
- if err != nil {
- return errors.Wrapf(err, "unable to get latest pod")
- }
- } else {
- pod, err = runtime.LookupPod(args[0])
- if err != nil {
- return err
- }
- }
-
- podInspectData, err := pod.Inspect()
- if err != nil {
- return err
- }
- b, err := json.MarshalIndent(&podInspectData, "", " ")
- if err != nil {
- return err
- }
- fmt.Println(string(b))
- return nil
-}