mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-30 20:34:39 +02:00
add support for selinux in verbose mount
This corresponds to specifying the `z` or `Z` option in the third portion of a terse mount specification (i.e. src:trg:z) Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
This commit is contained in:
parent
e893d06313
commit
d7cf0966d3
@ -431,6 +431,11 @@ def mount_desc_to_mount_args(compose, mount_desc, srv_name, cnt_name): # pylint
|
|||||||
tmpfs_mode = tmpfs_opts.get("mode", None)
|
tmpfs_mode = tmpfs_opts.get("mode", None)
|
||||||
if tmpfs_mode:
|
if tmpfs_mode:
|
||||||
opts.append(f"tmpfs-mode={tmpfs_mode}")
|
opts.append(f"tmpfs-mode={tmpfs_mode}")
|
||||||
|
if mount_type == "bind":
|
||||||
|
bind_opts = mount_desc.get("bind", {})
|
||||||
|
selinux = bind_opts.get("selinux", None)
|
||||||
|
if selinux is not None:
|
||||||
|
opts.append(selinux)
|
||||||
opts = ",".join(opts)
|
opts = ",".join(opts)
|
||||||
if mount_type == "bind":
|
if mount_type == "bind":
|
||||||
return f"type=bind,source={source},destination={target},{opts}".rstrip(",")
|
return f"type=bind,source={source},destination={target},{opts}".rstrip(",")
|
||||||
@ -486,6 +491,12 @@ def mount_desc_to_volume_args(compose, mount_desc, srv_name, cnt_name): # pylin
|
|||||||
read_only = mount_desc.get("read_only", None)
|
read_only = mount_desc.get("read_only", None)
|
||||||
if read_only is not None:
|
if read_only is not None:
|
||||||
opts.append("ro" if read_only else "rw")
|
opts.append("ro" if read_only else "rw")
|
||||||
|
if mount_type == "bind":
|
||||||
|
bind_opts = mount_desc.get("bind", {})
|
||||||
|
selinux = bind_opts.get("selinux", None)
|
||||||
|
if selinux is not None:
|
||||||
|
opts.append(selinux)
|
||||||
|
|
||||||
args = f"{source}:{target}"
|
args = f"{source}:{target}"
|
||||||
if opts:
|
if opts:
|
||||||
args += ":" + ",".join(opts)
|
args += ":" + ",".join(opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user