Do not read dotfiles in zones.d directory
This commit is contained in:
parent
50d179cbd3
commit
a36411416c
1 changed files with 5 additions and 2 deletions
|
@ -92,7 +92,8 @@ impl ZoneConfig {
|
||||||
let path = confy::get_configuration_file_path(env!("CARGO_PKG_NAME"), "interfaces").expect("Something went wrong with confy");
|
let path = confy::get_configuration_file_path(env!("CARGO_PKG_NAME"), "interfaces").expect("Something went wrong with confy");
|
||||||
let zones_dir = path.parent().expect("Something went wrong with confy").join("zones.d/");
|
let zones_dir = path.parent().expect("Something went wrong with confy").join("zones.d/");
|
||||||
|
|
||||||
let zones = fs::read_dir(zones_dir).unwrap();
|
let zones = fs::read_dir(zones_dir).expect("Directory creation handling does not yet exist");
|
||||||
|
|
||||||
|
|
||||||
let mut zone_configs: Vec<Self> = vec![];
|
let mut zone_configs: Vec<Self> = vec![];
|
||||||
|
|
||||||
|
@ -106,7 +107,9 @@ impl ZoneConfig {
|
||||||
false => eprintln!("[WARN] {warn_msg}"),
|
false => eprintln!("[WARN] {warn_msg}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if !path.file_name().expect("Directories should have been filtered out by the leading if")
|
||||||
|
.to_str().expect("Conversion to str should not fail for a file name")
|
||||||
|
.starts_with('.') {
|
||||||
let zone_config_path = format!("zones.d/{}", path.file_stem()
|
let zone_config_path = format!("zones.d/{}", path.file_stem()
|
||||||
.expect("stem could not be extracted from filename").to_str()
|
.expect("stem could not be extracted from filename").to_str()
|
||||||
.expect("&OsStr could not be converted to &str"));
|
.expect("&OsStr could not be converted to &str"));
|
||||||
|
|
Loading…
Reference in a new issue