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

@ -9,8 +9,9 @@ use nix::ioctl_read_bad;
use nix::sys::socket::{socket, AddressFamily, SockType, SockFlag};
use regex::Regex;
use proxmox::*; // for IP macros
use proxmox::tools::fd::Fd;
use pbs_api_types::*; // for IP macros
use proxmox_sys::fd::Fd;
pub static IPV4_REVERSE_MASK: &[&str] = &[
"0.0.0.0",
@ -188,7 +189,7 @@ pub fn compute_file_diff(filename: &str, shadow: &str) -> Result<String, Error>
.output()
.map_err(|err| format_err!("failed to execute diff - {}", err))?;
let diff = pbs_tools::command_output_as_string(output, Some(|c| c == 0 || c == 1))
let diff = proxmox_sys::command::command_output_as_string(output, Some(|c| c == 0 || c == 1))
.map_err(|err| format_err!("diff failed: {}", err))?;
Ok(diff)
@ -209,7 +210,7 @@ pub fn network_reload() -> Result<(), Error> {
.output()
.map_err(|err| format_err!("failed to execute 'ifreload' - {}", err))?;
pbs_tools::command_output(output, None)
proxmox_sys::command::command_output(output, None)
.map_err(|err| format_err!("ifreload failed: {}", err))?;

View File

@ -6,7 +6,7 @@ use serde::de::{value, IntoDeserializer, Deserialize};
use lazy_static::lazy_static;
use regex::Regex;
use proxmox::tools::{fs::replace_file, fs::CreateOptions};
use proxmox_sys::{fs::replace_file, fs::CreateOptions};
mod helper;
pub use helper::*;
@ -409,10 +409,10 @@ pub fn lock_config() -> Result<BackupLockGuard, Error> {
pub fn config() -> Result<(NetworkConfig, [u8;32]), Error> {
let content = match proxmox::tools::fs::file_get_optional_contents(NETWORK_INTERFACES_NEW_FILENAME)? {
let content = match proxmox_sys::fs::file_get_optional_contents(NETWORK_INTERFACES_NEW_FILENAME)? {
Some(content) => content,
None => {
let content = proxmox::tools::fs::file_get_optional_contents(NETWORK_INTERFACES_FILENAME)?;
let content = proxmox_sys::fs::file_get_optional_contents(NETWORK_INTERFACES_FILENAME)?;
content.unwrap_or_default()
}
};

View File

@ -184,7 +184,7 @@ impl <R: BufRead> NetworkParser<R> {
self.eat(Token::Gateway)?;
let gateway = self.next_text()?;
if proxmox::tools::common_regex::IP_REGEX.is_match(&gateway) {
if pbs_api_types::common_regex::IP_REGEX.is_match(&gateway) {
if gateway.contains(':') {
set_gateway_v6(interface, gateway)?;
} else {