From 7de35470c9d024316bf67ff5080f83875059ceba Mon Sep 17 00:00:00 2001 From: Paul Nettleton Date: Thu, 30 May 2024 01:39:59 -0500 Subject: [PATCH] feat(container): add `subpath` image mount option Signed-off-by: Paul Nettleton --- src/quadlet/container/mount.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/quadlet/container/mount.rs b/src/quadlet/container/mount.rs index ca0f07b..9d84e5d 100644 --- a/src/quadlet/container/mount.rs +++ b/src/quadlet/container/mount.rs @@ -387,6 +387,10 @@ pub struct Image { skip_serializing_if = "Not::not" )] pub read_write: bool, + + /// Mount only a specific path within the image, instead of the whole image. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subpath: Option, } /// Volume type [`Mount`]. @@ -512,14 +516,16 @@ mod tests { #[test] fn image() { - let string = "type=image,source=fedora,destination=/fedora-image,readwrite=true"; + let string = + "type=image,source=fedora,destination=/fedora-image,readwrite=true,subpath=path"; let mount: Mount = string.parse().unwrap(); assert_eq!( mount, Mount::Image(Image { source: "fedora".into(), destination: "/fedora-image".into(), - read_write: true + read_write: true, + subpath: Some("path".into()), }), ); assert_eq!(mount.to_string(), string);