src/config/network.rs: implement network reload, set "changes" attribute

This commit is contained in:
Dietmar Maurer
2020-04-24 09:55:46 +02:00
parent 8a6b86b8a7
commit 2eefd9aee1
4 changed files with 107 additions and 5 deletions

View File

@ -387,6 +387,15 @@ pub fn config() -> Result<(NetworkConfig, [u8;32]), Error> {
Ok((data, digest))
}
pub fn changes() -> Result<String, Error> {
if !std::path::Path::new(NETWORK_INTERFACES_NEW_FILENAME).exists() {
return Ok(String::new());
}
compute_file_diff(NETWORK_INTERFACES_FILENAME, NETWORK_INTERFACES_NEW_FILENAME)
}
pub fn save_config(config: &NetworkConfig) -> Result<(), Error> {
let mut raw = Vec::new();