diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-10-18 13:40:21 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-10-22 14:32:54 -0400 |
commit | f60a814e4d9da87ac0dd5835b9a790a0b63f54b3 (patch) | |
tree | 1022a89d01e4f12e8ff8cd2b4a111073d262365f /libpod | |
parent | d358840ebe02f45ef782546fc3f8369ff2870ea5 (diff) | |
download | podman-f60a814e4d9da87ac0dd5835b9a790a0b63f54b3.tar.gz podman-f60a814e4d9da87ac0dd5835b9a790a0b63f54b3.tar.bz2 podman-f60a814e4d9da87ac0dd5835b9a790a0b63f54b3.zip |
Add parsing for UID, GID in volume "o" option
Everything else is a flag to mount, but "uid" and "gid" are not.
We need to parse them out of "o" and handle them separately.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/options.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go index ddc5993af..17a075d2d 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1487,6 +1487,8 @@ func WithVolumeLabels(labels map[string]string) VolumeCreateOption { } // WithVolumeOptions sets the options of the volume. +// If the "local" driver has been selected, options will be validated. There are +// currently 3 valid options for the "local" driver - o, type, and device. func WithVolumeOptions(options map[string]string) VolumeCreateOption { return func(volume *Volume) error { if volume.valid { @@ -1495,6 +1497,13 @@ func WithVolumeOptions(options map[string]string) VolumeCreateOption { volume.config.Options = make(map[string]string) for key, value := range options { + switch key { + case "type", "device", "o": + volume.config.Options[key] = value + default: + return errors.Wrapf(define.ErrInvalidArg, "unrecognized volume option %q is not supported with local driver", key) + } + volume.config.Options[key] = value } |