depend on proxmox 0.1.38, use new fs helper functions

This commit is contained in:
Dietmar Maurer
2020-05-28 10:06:44 +02:00
parent f5056656b2
commit 3eeba68785
6 changed files with 23 additions and 60 deletions

View File

@ -120,16 +120,9 @@ pub const USER_CFG_FILENAME: &str = "/etc/proxmox-backup/user.cfg";
pub const USER_CFG_LOCKFILE: &str = "/etc/proxmox-backup/.user.lck";
pub fn config() -> Result<(SectionConfigData, [u8;32]), Error> {
let content = match std::fs::read_to_string(USER_CFG_FILENAME) {
Ok(c) => c,
Err(err) => {
if err.kind() == std::io::ErrorKind::NotFound {
String::from("")
} else {
bail!("unable to read '{}' - {}", USER_CFG_FILENAME, err);
}
}
};
let content = proxmox::tools::fs::file_read_optional_string(USER_CFG_FILENAME)?;
let content = content.unwrap_or(String::from(""));
let digest = openssl::sha::sha256(content.as_bytes());
let mut data = CONFIG.parse(USER_CFG_FILENAME, &content)?;