summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-07-23 15:22:35 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-25 14:44:57 +0000
commite56717833e52db68a334018a43a0b1a698d30aa8 (patch)
tree6636e8a234681d907056e8eaf251cc718ae51ecb /pkg/spec
parentc90b7400a8b9ffc77de69ad3aae1754ac006ba21 (diff)
downloadpodman-e56717833e52db68a334018a43a0b1a698d30aa8.tar.gz
podman-e56717833e52db68a334018a43a0b1a698d30aa8.tar.bz2
podman-e56717833e52db68a334018a43a0b1a698d30aa8.zip
Clear variables used to store options after parsing for every volume
If more than one volume was mounted using the --volume flag in podman run, the second and onwards volumes were picking up options of the previous volume mounts defined. Found out that the options were not be cleared out after every volume was parsed. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #1142 Approved by: mheon
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/createconfig.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 1dba8cdb4..0bd6c6d1c 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -147,8 +147,13 @@ func (c *CreateConfig) CreateBlockIO() (*spec.LinuxBlockIO, error) {
//GetVolumeMounts takes user provided input for bind mounts and creates Mount structs
func (c *CreateConfig) GetVolumeMounts(specMounts []spec.Mount) ([]spec.Mount, error) {
var m []spec.Mount
- var options []string
for _, i := range c.Volumes {
+ var (
+ options []string
+ foundrw, foundro, foundz, foundZ bool
+ rootProp string
+ )
+
// We need to handle SELinux options better here, specifically :Z
spliti := strings.Split(i, ":")
if len(spliti) > 2 {
@@ -158,8 +163,6 @@ func (c *CreateConfig) GetVolumeMounts(specMounts []spec.Mount) ([]spec.Mount, e
continue
}
options = append(options, "rbind")
- var foundrw, foundro, foundz, foundZ bool
- var rootProp string
for _, opt := range options {
switch opt {
case "rw":