summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-06-24 14:44:28 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2020-06-29 17:58:50 +0200
commitb32172e20bbb701e924684ee7ef443748a4f112b (patch)
tree01a05f446b5bde43bd174591e909d136576bed50 /libpod/options.go
parent688cc0aee3f031661b930811b2d95df1d6c601ac (diff)
downloadpodman-b32172e20bbb701e924684ee7ef443748a4f112b.tar.gz
podman-b32172e20bbb701e924684ee7ef443748a4f112b.tar.bz2
podman-b32172e20bbb701e924684ee7ef443748a4f112b.zip
container: move volume chown after spec generation
move the chown for newly created volumes after the spec generation so the correct UID/GID are known. Closes: https://github.com/containers/libpod/issues/5698 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 7a60870a0..cfc0397e3 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1497,6 +1497,19 @@ func WithVolumeGID(gid int) VolumeCreateOption {
}
}
+// WithVolumeNeedsChown sets the NeedsChown flag for the volume.
+func WithVolumeNeedsChown() VolumeCreateOption {
+ return func(volume *Volume) error {
+ if volume.valid {
+ return define.ErrVolumeFinalized
+ }
+
+ volume.state.NeedsChown = true
+
+ return nil
+ }
+}
+
// withSetAnon sets a bool notifying libpod that this volume is anonymous and
// should be removed when containers using it are removed and volumes are
// specified for removal.