mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 10:58:21 +00:00
Move Networkd Apply
This commit is contained in:
parent
6b52ab0a5a
commit
e6816fe46f
1 changed files with 4 additions and 2 deletions
|
@ -8,6 +8,8 @@ use std::{error::Error, io::Write};
|
||||||
use tera::Context;
|
use tera::Context;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
|
const NETWORKD_CONFIG_PATH: &str = "/etc/systemd/network";
|
||||||
|
|
||||||
pub struct File {
|
pub struct File {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub content: String,
|
pub content: String,
|
||||||
|
@ -38,13 +40,13 @@ pub fn apply_networkd(pending_config: Config, current_config: Config) -> Result<
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Deleting old Networkd Configs");
|
info!("Deleting old Networkd Configs");
|
||||||
match delete_files_in_folder("/etc/systemd/network") {
|
match delete_files_in_folder(NETWORKD_CONFIG_PATH) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => return Err(ApplyError::IOError(err)),
|
Err(err) => return Err(ApplyError::IOError(err)),
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Writing new Networkd Configs");
|
info!("Writing new Networkd Configs");
|
||||||
match create_files_in_folder("/etc/systemd/network", files) {
|
match create_files_in_folder(NETWORKD_CONFIG_PATH, files) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) => return Err(ApplyError::IOError(err)),
|
Err(err) => return Err(ApplyError::IOError(err)),
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue