replace file_set_contents with replace_file
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
@ -7,7 +7,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_read_firstline, file_set_contents};
|
||||
use proxmox::tools::fs::{file_read_firstline, replace_file, CreateOptions};
|
||||
|
||||
use crate::api2::types::*;
|
||||
|
||||
@ -71,7 +71,7 @@ fn set_timezone(
|
||||
bail!("No such timezone.");
|
||||
}
|
||||
|
||||
file_set_contents("/etc/timezone", timezone.as_bytes(), None)?;
|
||||
replace_file("/etc/timezone", timezone.as_bytes(), CreateOptions::new())?;
|
||||
|
||||
let _ = std::fs::remove_file("/etc/localtime");
|
||||
|
||||
|
Reference in New Issue
Block a user