mirror of
https://github.com/containers/podman.git
synced 2026-03-13 08:01:19 +08:00
Quadlet Volume - allow setting mount option without a device
Fixes: #28132 Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
This commit is contained in:
@@ -1186,14 +1186,10 @@ func ConvertVolume(volume *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, i
|
||||
|
||||
mountOpts, ok := volume.Lookup(VolumeGroup, KeyOptions)
|
||||
if ok && len(mountOpts) != 0 {
|
||||
if devValid {
|
||||
if opts.Len() > 2 {
|
||||
opts.WriteString(",")
|
||||
}
|
||||
opts.WriteString(mountOpts)
|
||||
} else {
|
||||
return nil, warnings, fmt.Errorf("key Options can't be used without Device")
|
||||
if opts.Len() > 2 {
|
||||
opts.WriteString(",")
|
||||
}
|
||||
opts.WriteString(mountOpts)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
7
test/e2e/quadlet/mount-options.volume
Normal file
7
test/e2e/quadlet/mount-options.volume
Normal file
@@ -0,0 +1,7 @@
|
||||
## assert-last-key-contains Service ExecStart " --opt o=uid=0,gid=11,rw,compress=zstd "
|
||||
|
||||
[Volume]
|
||||
# Test usernames too
|
||||
User=root
|
||||
Group=11
|
||||
Options=rw,compress=zstd
|
||||
@@ -1017,6 +1017,7 @@ BOGUS=foo
|
||||
Entry("Volume - global args", "globalargs.volume"),
|
||||
Entry("Volume - Containers Conf Modules", "containersconfmodule.volume"),
|
||||
Entry("Volume - Type=bind", "device-bind.volume"),
|
||||
Entry("mount-options.volume", "mount-options.volume"),
|
||||
|
||||
Entry("Absolute Path", "absolute.path.kube"),
|
||||
Entry("Basic kube", "basic.kube"),
|
||||
|
||||
Reference in New Issue
Block a user