summaryrefslogtreecommitdiff
path: root/cmd/podman/volume_inspect.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-02-11 12:47:47 -0600
committerbaude <bbaude@redhat.com>2019-02-13 12:43:51 -0600
commit4f60f79a27012220afdbcf8f2f4bb4622ca8c176 (patch)
tree5a0a43a03a17ad51678695a9d65270725b0b7893 /cmd/podman/volume_inspect.go
parent8a16f83b0a13ab9de1cc905a3ff1132c75739995 (diff)
downloadpodman-4f60f79a27012220afdbcf8f2f4bb4622ca8c176.tar.gz
podman-4f60f79a27012220afdbcf8f2f4bb4622ca8c176.tar.bz2
podman-4f60f79a27012220afdbcf8f2f4bb4622ca8c176.zip
podman-remote volume inspect|ls
add the ability to list and inspect volumes using the remote client and varlink Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/volume_inspect.go')
-rw-r--r--cmd/podman/volume_inspect.go22
1 files changed, 9 insertions, 13 deletions
diff --git a/cmd/podman/volume_inspect.go b/cmd/podman/volume_inspect.go
index a8e6f489f..928ef37d0 100644
--- a/cmd/podman/volume_inspect.go
+++ b/cmd/podman/volume_inspect.go
@@ -2,9 +2,8 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
+ "github.com/containers/libpod/libpod/adapter"
"github.com/pkg/errors"
- "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -39,22 +38,19 @@ func init() {
}
func volumeInspectCmd(c *cliconfig.VolumeInspectValues) error {
- var err error
+ if (c.All && len(c.InputArgs) > 0) || (!c.All && len(c.InputArgs) < 1) {
+ return errors.New("provide one or more volume names or use --all")
+ }
- runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
}
defer runtime.Shutdown(false)
- opts := volumeLsOptions{
- Format: c.Format,
- }
-
- vols, lastError := getVolumesFromContext(&c.PodmanCommand, runtime)
- if lastError != nil {
- logrus.Errorf("%q", lastError)
+ vols, err := runtime.InspectVolumes(getContext(), c)
+ if err != nil {
+ return err
}
-
- return generateVolLsOutput(vols, opts, runtime)
+ return generateVolLsOutput(vols, volumeLsOptions{Format: c.Format})
}