summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-06-25 00:20:25 +0200
committerGitHub <noreply@github.com>2019-06-25 00:20:25 +0200
commitd8b18a98791a49f5352d6a849cef7bff136cbb2c (patch)
tree21fc7842615b30a5c6bc9cd031a7476b7a3ef313 /libpod
parent394e12aa656ed3d9cc0afef48f1315fff5ed5db3 (diff)
parent2d9f1e95eb00242751ff0d9655bb513c27173475 (diff)
downloadpodman-d8b18a98791a49f5352d6a849cef7bff136cbb2c.tar.gz
podman-d8b18a98791a49f5352d6a849cef7bff136cbb2c.tar.bz2
podman-d8b18a98791a49f5352d6a849cef7bff136cbb2c.zip
Merge pull request #3401 from mheon/templating_is_dumb
Fix inspect --format '{{.Mounts}}.
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_inspect.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index 1d12b1b35..3ac774060 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -46,7 +46,7 @@ type InspectContainerData struct {
GraphDriver *driver.Data `json:"GraphDriver"`
SizeRw int64 `json:"SizeRw,omitempty"`
SizeRootFs int64 `json:"SizeRootFs,omitempty"`
- Mounts []*InspectMount `json:"Mounts"`
+ Mounts []InspectMount `json:"Mounts"`
Dependencies []string `json:"Dependencies"`
NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO
ExitCommand []string `json:"ExitCommand"`
@@ -111,10 +111,10 @@ type InspectMount struct {
// The name of the volume. Empty for bind mounts.
Name string `json:"Name,omptempty"`
// The source directory for the volume.
- Src string `json:"Source"`
+ Source string `json:"Source"`
// The destination directory for the volume. Specified as a path within
// the container, as it would be passed into the OCI runtime.
- Dst string `json:"Destination"`
+ Destination string `json:"Destination"`
// The driver used for the named volume. Empty for bind mounts.
Driver string `json:"Driver"`
// Contains SELinux :z/:Z mount options. Unclear what, if anything, else
@@ -359,8 +359,8 @@ func (c *Container) getContainerInspectData(size bool, driverData *driver.Data)
// Get inspect-formatted mounts list.
// Only includes user-specified mounts. Only includes bind mounts and named
// volumes, not tmpfs volumes.
-func (c *Container) getInspectMounts(ctrSpec *spec.Spec) ([]*InspectMount, error) {
- inspectMounts := []*InspectMount{}
+func (c *Container) getInspectMounts(ctrSpec *spec.Spec) ([]InspectMount, error) {
+ inspectMounts := []InspectMount{}
// No mounts, return early
if len(c.config.UserVolumes) == 0 {
@@ -384,9 +384,9 @@ func (c *Container) getInspectMounts(ctrSpec *spec.Spec) ([]*InspectMount, error
// We need to look up the volumes.
// First: is it a named volume?
if volume, ok := namedVolumes[vol]; ok {
- mountStruct := new(InspectMount)
+ mountStruct := InspectMount{}
mountStruct.Type = "volume"
- mountStruct.Dst = volume.Dest
+ mountStruct.Destination = volume.Dest
mountStruct.Name = volume.Name
// For src and driver, we need to look up the named
@@ -396,9 +396,9 @@ func (c *Container) getInspectMounts(ctrSpec *spec.Spec) ([]*InspectMount, error
return nil, errors.Wrapf(err, "error looking up volume %s in container %s config", volume.Name, c.ID())
}
mountStruct.Driver = volFromDB.Driver()
- mountStruct.Src = volFromDB.MountPoint()
+ mountStruct.Source = volFromDB.MountPoint()
- parseMountOptionsForInspect(volume.Options, mountStruct)
+ parseMountOptionsForInspect(volume.Options, &mountStruct)
inspectMounts = append(inspectMounts, mountStruct)
} else if mount, ok := mounts[vol]; ok {
@@ -408,12 +408,12 @@ func (c *Container) getInspectMounts(ctrSpec *spec.Spec) ([]*InspectMount, error
continue
}
- mountStruct := new(InspectMount)
+ mountStruct := InspectMount{}
mountStruct.Type = "bind"
- mountStruct.Src = mount.Source
- mountStruct.Dst = mount.Destination
+ mountStruct.Source = mount.Source
+ mountStruct.Destination = mount.Destination
- parseMountOptionsForInspect(mount.Options, mountStruct)
+ parseMountOptionsForInspect(mount.Options, &mountStruct)
inspectMounts = append(inspectMounts, mountStruct)
}