diff options
Diffstat (limited to 'src/install.rs')
-rw-r--r-- | src/install.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/install.rs b/src/install.rs index 7506e0d..dce0fea 100644 --- a/src/install.rs +++ b/src/install.rs @@ -6,9 +6,9 @@ use crate::cloudinit::{CloudInitConfig, CloudInitError}; use crate::image::VirtualMachineImage; +use std::path::{Path, PathBuf}; use std::process::Command; use std::result::Result; -use tempfile::tempdir; /// Errors from this module #[derive(Debug, thiserror::Error)] @@ -91,9 +91,7 @@ impl VirtInstallArgs { } /// Create new VM with virt-install. -pub fn virt_install(args: &VirtInstallArgs) -> Result<(), VirtInstallError> { - let dir = tempdir()?; - let iso = dir.path().join("cloudinit.iso"); +pub fn virt_install(args: &VirtInstallArgs, iso: &Path) -> Result<PathBuf, VirtInstallError> { args.init().create_iso(&iso)?; let r = Command::new("virt-install") @@ -122,5 +120,5 @@ pub fn virt_install(args: &VirtInstallArgs) -> Result<(), VirtInstallError> { let stderr = String::from_utf8(r.stderr)?; return Err(VirtInstallError::VirtInstallFailed(stderr)); } - Ok(()) + Ok(iso.to_path_buf()) } |