summaryrefslogtreecommitdiff
path: root/pkg/adapter
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-10-21 22:20:40 +0200
committerGitHub <noreply@github.com>2019-10-21 22:20:40 +0200
commitefc54c3987f95fd94b5e0aa41dd307be49d1b31b (patch)
tree1820209fcc96b950caac0fc7a9a45c0b75a10823 /pkg/adapter
parentd2591a54335424263374a919d485712e5b8aa093 (diff)
parent03da8b641df1c03aea6f9faa3ddc2b0df64ec68b (diff)
downloadpodman-efc54c3987f95fd94b5e0aa41dd307be49d1b31b.tar.gz
podman-efc54c3987f95fd94b5e0aa41dd307be49d1b31b.tar.bz2
podman-efc54c3987f95fd94b5e0aa41dd307be49d1b31b.zip
Merge pull request #4284 from mheon/fix_vol_inspect
Show volume options in 'volume inspect'
Diffstat (limited to 'pkg/adapter')
-rw-r--r--pkg/adapter/runtime_remote.go37
1 files changed, 32 insertions, 5 deletions
diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go
index 3b808a2ee..870e86896 100644
--- a/pkg/adapter/runtime_remote.go
+++ b/pkg/adapter/runtime_remote.go
@@ -659,12 +659,39 @@ func (r *LocalRuntime) Push(ctx context.Context, srcName, destination, manifestM
}
// InspectVolumes returns a slice of volumes based on an arg list or --all
-func (r *LocalRuntime) InspectVolumes(ctx context.Context, c *cliconfig.VolumeInspectValues) ([]*Volume, error) {
- reply, err := iopodman.GetVolumes().Call(r.Conn, c.InputArgs, c.All)
- if err != nil {
- return nil, err
+func (r *LocalRuntime) InspectVolumes(ctx context.Context, c *cliconfig.VolumeInspectValues) ([]*libpod.InspectVolumeData, error) {
+ var (
+ inspectData []*libpod.InspectVolumeData
+ volumes []string
+ )
+
+ if c.All {
+ allVolumes, err := r.Volumes(ctx)
+ if err != nil {
+ return nil, err
+ }
+ for _, vol := range allVolumes {
+ volumes = append(volumes, vol.Name())
+ }
+ } else {
+ for _, arg := range c.InputArgs {
+ volumes = append(volumes, arg)
+ }
}
- return varlinkVolumeToVolume(r, reply), nil
+
+ for _, vol := range volumes {
+ jsonString, err := iopodman.InspectVolume().Call(r.Conn, vol)
+ if err != nil {
+ return nil, err
+ }
+ inspectJSON := new(libpod.InspectVolumeData)
+ if err := json.Unmarshal([]byte(jsonString), inspectJSON); err != nil {
+ return nil, errors.Wrapf(err, "error unmarshalling inspect JSON for volume %s", vol)
+ }
+ inspectData = append(inspectData, inspectJSON)
+ }
+
+ return inspectData, nil
}
// Volumes returns a slice of adapter.volumes based on information about libpod