diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-09-17 13:02:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-17 13:02:23 +0200 |
commit | 799aa7022bcf4b8b76276f86ea633c960351fb93 (patch) | |
tree | f91f8ce4c22f679cb2de97a39d4aab5911896203 /pkg/spec/storage.go | |
parent | 2aa6771e787b46484245445b899cd2694aadbfc2 (diff) | |
parent | 405ef9bc5636b8940f93413231ed1e4299e3d4ac (diff) | |
download | podman-799aa7022bcf4b8b76276f86ea633c960351fb93.tar.gz podman-799aa7022bcf4b8b76276f86ea633c960351fb93.tar.bz2 podman-799aa7022bcf4b8b76276f86ea633c960351fb93.zip |
Merge pull request #4034 from rhatdan/relabel
Add 'relabel' to --mount options
Diffstat (limited to 'pkg/spec/storage.go')
-rw-r--r-- | pkg/spec/storage.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/pkg/spec/storage.go b/pkg/spec/storage.go index bc0eaad6d..cc091dcee 100644 --- a/pkg/spec/storage.go +++ b/pkg/spec/storage.go @@ -389,7 +389,7 @@ func getBindMount(args []string) (spec.Mount, error) { Type: TypeBind, } - var setSource, setDest, setRORW, setSuid, setDev, setExec bool + var setSource, setDest, setRORW, setSuid, setDev, setExec, setRelabel bool for _, val := range args { kv := strings.Split(val, "=") @@ -467,6 +467,22 @@ func getBindMount(args []string) (spec.Mount, error) { } newMount.Destination = kv[1] setDest = true + case "relabel": + if setRelabel { + return newMount, errors.Wrapf(optionArgError, "cannot pass 'relabel' option more than once") + } + setRelabel = true + if len(kv) != 2 { + return newMount, errors.Wrapf(util.ErrBadMntOption, "%s mount option must be 'private' or 'shared'", kv[0]) + } + switch kv[1] { + case "private": + newMount.Options = append(newMount.Options, "z") + case "shared": + newMount.Options = append(newMount.Options, "Z") + default: + return newMount, errors.Wrapf(util.ErrBadMntOption, "%s mount option must be 'private' or 'shared'", kv[0]) + } default: return newMount, errors.Wrapf(util.ErrBadMntOption, kv[0]) } |