summaryrefslogtreecommitdiff
path: root/src/spec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/spec.rs')
-rw-r--r--src/spec.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/spec.rs b/src/spec.rs
index a1d1c2f..a00a5e8 100644
--- a/src/spec.rs
+++ b/src/spec.rs
@@ -1,6 +1,7 @@
//! Virtual machine specification.
use crate::config::Configuration;
+use crate::util::expand_tilde;
use log::debug;
use serde::{Deserialize, Serialize};
@@ -293,8 +294,8 @@ impl Specification {
ecdsa_host_cert: input.ecdsa_host_cert.clone(),
ed25519_host_key: input.ed25519_host_key.clone(),
ed25519_host_cert: input.ed25519_host_cert.clone(),
- base: input.base_image(config, name)?,
- image: input.image(config, name)?,
+ base: expand_tilde(&input.base_image(config, name)?),
+ image: expand_tilde(&input.image(config, name)?),
image_size_gib: input.image_size_gib(config, name)?,
memory_mib: input.memory_mib(config, name)?,
cpus: input.cpus(config, name)?,
@@ -311,8 +312,9 @@ impl Specification {
fn ssh_keys(filenames: &[PathBuf]) -> Result<Vec<String>, SpecificationError> {
let mut keys = vec![];
for filename in filenames {
- let key = std::fs::read(filename)
- .map_err(|e| SpecificationError::SshKeyRead(filename.to_path_buf(), e))?;
+ let filename = expand_tilde(filename);
+ let key =
+ std::fs::read(&filename).map_err(|e| SpecificationError::SshKeyRead(filename, e))?;
let key = String::from_utf8(key)?;
let key = key.strip_suffix("\n").or(Some(&key)).unwrap();
keys.push(key.to_string());