update to proxmox-sys 0.2 crate

- imported pbs-api-types/src/common_regex.rs from old proxmox crate
- use hex crate to generate/parse hex digest
- remove all reference to proxmox crate (use proxmox-sys and
  proxmox-serde instead)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer
2021-11-23 17:57:00 +01:00
parent bd00ff10e4
commit 25877d05ac
201 changed files with 627 additions and 1535 deletions

View File

@ -5,8 +5,8 @@ use std::path::Path;
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox::sys::error::SysError;
use proxmox::tools::fs::{CreateOptions, file_read_string};
use proxmox_sys::error::SysError;
use proxmox_sys::fs::{CreateOptions, file_read_string};
use pbs_api_types::PROXMOX_SAFE_ID_REGEX;
@ -32,7 +32,7 @@ fn root_only() -> CreateOptions {
}
fn create_acme_subdir(dir: &str) -> nix::Result<()> {
match proxmox::tools::fs::create_dir(dir, root_only()) {
match proxmox_sys::fs::create_dir(dir, root_only()) {
Ok(()) => Ok(()),
Err(err) if err.already_exists() => Ok(()),
Err(err) => Err(err),
@ -70,7 +70,7 @@ pub fn foreach_acme_account<F>(mut func: F) -> Result<(), Error>
where
F: FnMut(AcmeAccountName) -> ControlFlow<Result<(), Error>>,
{
match pbs_tools::fs::scan_subdir(-1, ACME_ACCOUNT_DIR, &PROXMOX_SAFE_ID_REGEX) {
match proxmox_sys::fs::scan_subdir(-1, ACME_ACCOUNT_DIR, &PROXMOX_SAFE_ID_REGEX) {
Ok(files) => {
for file in files {
let file = file?;

View File

@ -90,7 +90,7 @@ pub struct DnsPlugin {
// We handle this property separately in the API calls.
/// DNS plugin data (base64url encoded without padding).
#[serde(with = "proxmox::tools::serde::string_as_base64url_nopad")]
#[serde(with = "proxmox_serde::string_as_base64url_nopad")]
pub data: String,
}
@ -141,7 +141,7 @@ pub fn lock() -> Result<BackupLockGuard, Error> {
}
pub fn config() -> Result<(PluginData, [u8; 32]), Error> {
let content = proxmox::tools::fs::file_read_optional_string(ACME_PLUGIN_CFG_FILENAME)?
let content = proxmox_sys::fs::file_read_optional_string(ACME_PLUGIN_CFG_FILENAME)?
.unwrap_or_else(|| "".to_string());
let digest = openssl::sha::sha256(content.as_bytes());