Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libazureinit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "libazureinit"
version = "0.1.1"
edition = "2021"
rust-version = "1.76"
build = "build.rs"
repository = "https://github.com/Azure/azure-init/"
homepage = "https://github.com/Azure/azure-init/"
Expand Down
14 changes: 8 additions & 6 deletions libazureinit/src/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,18 @@ pub fn parse_ovf_env(ovf_body: &str) -> Result<Environment, Error> {
pub fn mount_parse_ovf_env(dev: String) -> Result<Environment, Error> {
let mount_media =
Media::new(PathBuf::from(dev), PathBuf::from(PATH_MOUNT_POINT));
let mounted = mount_media.mount().inspect_err(
|e| tracing::error!(error = ?e, "Failed to mount media."),
)?;
let mounted = mount_media.mount().map_err(|e| {
tracing::error!(error = ?e, "Failed to mount media.");
e
})?;

let ovf_body = mounted.read_ovf_env_to_string()?;
let environment = parse_ovf_env(ovf_body.as_str())?;

mounted.unmount().inspect_err(
|e| tracing::error!(error = ?e, "Failed to remove media."),
)?;
mounted.unmount().map_err(|e| {
tracing::error!(error = ?e, "Failed to remove media.");
e
})?;

Ok(environment)
}
Expand Down