replace file_set_contents with replace_file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2019-12-18 11:05:30 +01:00
parent a66e7920dc
commit feaa1ad35f
9 changed files with 51 additions and 39 deletions

View File

@ -9,7 +9,7 @@ use serde_json::{json, Value};
use proxmox::{sortable, identity};
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::schema::*;
use proxmox::tools::fs::{file_get_contents, file_set_contents};
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
use proxmox::tools::*; // required to use IPRE!() macro ???
use crate::api2::types::*;
@ -91,7 +91,7 @@ fn update_dns(
data.push('\n');
}
file_set_contents(RESOLV_CONF_FN, data.as_bytes(), None)?;
replace_file(RESOLV_CONF_FN, data.as_bytes(), CreateOptions::new())?;
Ok(Value::Null)
}