Skip to content

Commit

Permalink
feat(container): add subpath image mount option
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Nettleton <[email protected]>
  • Loading branch information
k9withabone committed May 30, 2024
1 parent 1a867c0 commit 7de3547
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/quadlet/container/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf>,
}

/// Volume type [`Mount`].
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7de3547

Please sign in to comment.