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

@ -3,7 +3,7 @@ use serde_json::json;
use handlebars::{Handlebars, Helper, Context, RenderError, RenderContext, Output, HelperResult, TemplateError};
use proxmox::tools::email::sendmail;
use proxmox_sys::email::sendmail;
use proxmox_lang::try_block;
use proxmox_schema::{parse_property_string, ApiType};
@ -239,7 +239,7 @@ fn send_job_status_mail(
// so we include html as well
let html = format!("<html><body><pre>\n{}\n<pre>", handlebars::html_escape(text));
let nodename = proxmox::tools::nodename();
let nodename = proxmox_sys::nodename();
let author = format!("Proxmox Backup Server - {}", nodename);
@ -504,7 +504,7 @@ fn get_server_url() -> (String, usize) {
// user will surely request that they can change this
let nodename = proxmox::tools::nodename();
let nodename = proxmox_sys::nodename();
let mut fqdn = nodename.to_owned();
if let Ok(resolv_conf) = crate::api2::node::dns::read_etc_resolv_conf() {
@ -524,7 +524,7 @@ pub fn send_updates_available(
) -> Result<(), Error> {
// update mails always go to the root@pam configured email..
if let Some(email) = lookup_user_email(Userid::root_userid()) {
let nodename = proxmox::tools::nodename();
let nodename = proxmox_sys::nodename();
let subject = format!("New software packages available ({})", nodename);
let (fqdn, port) = get_server_url();

View File

@ -42,7 +42,7 @@ use std::path::{Path, PathBuf};
use anyhow::{bail, format_err, Error};
use serde::{Deserialize, Serialize};
use proxmox::tools::fs::{
use proxmox_sys::fs::{
create_path, file_read_optional_string, replace_file, CreateOptions,
};

View File

@ -7,7 +7,7 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::tools::fs::{create_path, CreateOptions};
use proxmox_sys::fs::{create_path, CreateOptions};
use pbs_buildcfg;

View File

@ -110,7 +110,7 @@ async fn pull_index_chunks<I: IndexFile>(
"sync chunk writer",
4,
move |(chunk, digest, size): (DataBlob, [u8; 32], u64)| {
// println!("verify and write {}", proxmox::tools::digest_to_hex(&digest));
// println!("verify and write {}", hex::encode(&digest));
chunk.verify_unencrypted(size as usize, &digest)?;
target2.insert_chunk(&chunk, &digest)?;
Ok(())
@ -133,10 +133,10 @@ async fn pull_index_chunks<I: IndexFile>(
target.cond_touch_chunk(&info.digest, false)
})?;
if chunk_exists {
//task_log!(worker, "chunk {} exists {}", pos, proxmox::tools::digest_to_hex(digest));
//task_log!(worker, "chunk {} exists {}", pos, hex::encode(digest));
return Ok::<_, Error>(());
}
//task_log!(worker, "sync {} chunk {}", pos, proxmox::tools::digest_to_hex(digest));
//task_log!(worker, "sync {} chunk {}", pos, hex::encode(digest));
let chunk = chunk_reader.read_raw_chunk(&info.digest).await?;
let raw_size = chunk.raw_size() as usize;

View File

@ -48,7 +48,7 @@ fn function_calls() -> Vec<FunctionMapping> {
}
pub fn generate_report() -> String {
use proxmox::tools::fs::file_read_optional_string;
use proxmox_sys::fs::file_read_optional_string;
let file_contents = files()
.iter()