summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-08-03 09:34:08 +0300
committerLars Wirzenius <liw@liw.fi>2021-08-05 10:12:21 +0300
commit37efe8e3d022d21bd2f6af741c8d5ee49da2fff5 (patch)
treeeb301167c07657836ca5b9fdb6e044da8242e976 /src/config.rs
parentc15ca42605d760d519721a3e39e1834ac5b1cb15 (diff)
downloadvmadm-37efe8e3d022d21bd2f6af741c8d5ee49da2fff5.tar.gz
feat: if no networks are specified, use default
Also, drop lan, wan from test config, because we can't assume they're available in the environment the tests are run in. Sponsored-by: author
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index 4786bdb..50b94b0 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -64,6 +64,7 @@ impl Configuration {
.map_err(|err| ConfigurationError::ReadError(filename.to_path_buf(), err))?;
let mut config: Configuration = serde_yaml::from_slice(&config)?;
config.expand_tildes();
+ config.fill_in_missing_networks();
debug!("config: {:#?}", config);
Ok(config)
} else {
@@ -71,6 +72,12 @@ impl Configuration {
}
}
+ fn fill_in_missing_networks(&mut self) {
+ if self.default_networks.is_none() {
+ self.default_networks = Some(vec!["default".to_string()]);
+ }
+ }
+
fn expand_tildes(&mut self) {
expand_optional_pathbuf(&mut self.default_base_image);
expand_optional_pathbuf(&mut self.image_directory);