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

@ -10,7 +10,7 @@ use http::HeaderMap;
use proxmox_lang::try_block;
use proxmox_router::{RpcEnvironmentType, UserInformation};
use proxmox::tools::fs::CreateOptions;
use proxmox_sys::fs::CreateOptions;
use proxmox_rest_server::{daemon, AuthError, ApiConfig, RestServer, RestEnvironment, ServerAdapter};

View File

@ -4,7 +4,7 @@ use std::io::{self, Write};
use anyhow::Error;
use serde_json::{json, Value};
use proxmox::tools::fs::CreateOptions;
use proxmox_sys::fs::CreateOptions;
use proxmox_router::{cli::*, RpcEnvironment};
use proxmox_schema::api;

View File

@ -17,8 +17,8 @@ use tokio_stream::wrappers::ReceiverStream;
use serde_json::{json, Value};
use http::{Method, HeaderMap};
use proxmox::sys::linux::socket::set_tcp_keepalive;
use proxmox::tools::fs::CreateOptions;
use proxmox_sys::linux::socket::set_tcp_keepalive;
use proxmox_sys::fs::CreateOptions;
use proxmox_lang::try_block;
use proxmox_router::{RpcEnvironment, RpcEnvironmentType, UserInformation};
use proxmox_http::client::{RateLimitedStream, ShareableRateLimit};
@ -145,7 +145,7 @@ async fn get_index_future(
None => (None, None),
};
let nodename = proxmox::tools::nodename();
let nodename = proxmox_sys::nodename();
let user = userid.as_ref().map(|u| u.as_str()).unwrap_or("");
let csrf_token = csrf_token.unwrap_or_else(|| String::from(""));
@ -815,7 +815,7 @@ async fn schedule_task_log_rotate() {
let max_files = 20; // times twenty files gives > 100000 task entries
let user = pbs_config::backup_user()?;
let options = proxmox::tools::fs::CreateOptions::new()
let options = proxmox_sys::fs::CreateOptions::new()
.owner(user.uid)
.group(user.gid);
@ -949,7 +949,7 @@ async fn generate_host_stats() {
}
fn generate_host_stats_sync() {
use proxmox::sys::linux::procfs::{
use proxmox_sys::linux::procfs::{
read_meminfo, read_proc_stat, read_proc_net_dev, read_loadavg};
match read_proc_stat() {

View File

@ -1,7 +1,7 @@
use anyhow::Error;
use serde_json::json;
use proxmox::tools::fs::CreateOptions;
use proxmox_sys::fs::CreateOptions;
use proxmox_router::{cli::*, RpcEnvironment, ApiHandler};
use proxmox_backup::api2;

View File

@ -6,6 +6,7 @@ use std::path::Path;
use anyhow::{bail, format_err, Error};
use serde_json::{json, Value};
use walkdir::WalkDir;
use hex::FromHex;
use proxmox_router::cli::{
format_and_print_result, get_output_format, CliCommand, CliCommandMap, CommandLineInterface,
@ -116,7 +117,7 @@ fn inspect_chunk(
let digest_raw: Option<[u8; 32]> = digest
.map(|ref d| {
proxmox::tools::hex_to_digest(d)
<[u8; 32]>::from_hex(d)
.map_err(|e| format_err!("could not parse chunk - {}", e))
})
.map_or(Ok(None), |r| r.map(Some))?;
@ -291,7 +292,7 @@ fn inspect_file(
for pos in 0..index.index_count() {
let digest = index.index_digest(pos).unwrap();
chunk_digests.insert(proxmox::tools::digest_to_hex(digest));
chunk_digests.insert(hex::encode(digest));
}
json!({

View File

@ -5,7 +5,6 @@ use std::path::Path;
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox::tools::digest_to_hex;
use proxmox_router::cli::{CliCommand, CliCommandMap, CommandLineInterface};
use proxmox_schema::api;
@ -87,7 +86,7 @@ fn recover_index(
let mut data = Vec::with_capacity(4 * 1024 * 1024);
for pos in 0..index.index_count() {
let chunk_digest = index.index_digest(pos).unwrap();
let digest_str = digest_to_hex(chunk_digest);
let digest_str = hex::encode(chunk_digest);
let digest_prefix = &digest_str[0..4];
let chunk_path = chunks_path.join(digest_prefix).join(digest_str);
let mut chunk_file = std::fs::File::open(&chunk_path)

View File

@ -3,7 +3,7 @@ use std::io::Write;
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::tools::fs::file_get_contents;
use proxmox_sys::fs::file_get_contents;
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;

View File

@ -3,7 +3,7 @@ use serde_json::Value;
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox::sys::linux::tty;
use proxmox_sys::linux::tty;
use pbs_api_types::{
Fingerprint, Kdf, DRIVE_NAME_SCHEMA, TAPE_ENCRYPTION_KEY_FINGERPRINT_SCHEMA,