forked from Proxmox/proxmox
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:
parent
4c66ea2789
commit
93625e4f87
@ -30,12 +30,12 @@ tokio-openssl = "0.6.1"
|
||||
tower-service = "0.3.0"
|
||||
url = "2.1"
|
||||
|
||||
proxmox = "0.15.3"
|
||||
proxmox-async = "0.2"
|
||||
#proxmox = "0.15.3"
|
||||
proxmox-async = "0.3"
|
||||
proxmox-io = "1"
|
||||
proxmox-lang = "1"
|
||||
proxmox-http = { version = "0.5.0", features = [ "client" ] }
|
||||
proxmox-http = { version = "0.6", features = [ "client" ] }
|
||||
proxmox-router = "1.1"
|
||||
proxmox-schema = { version = "1", features = [ "api-macro", "upid-api-impl" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-sys = "0.1.2"
|
||||
proxmox-sys = "0.2"
|
||||
|
@ -12,7 +12,7 @@ use hyper::http::request::Parts;
|
||||
use handlebars::Handlebars;
|
||||
use serde::Serialize;
|
||||
|
||||
use proxmox::tools::fs::{create_path, CreateOptions};
|
||||
use proxmox_sys::fs::{create_path, CreateOptions};
|
||||
use proxmox_router::{ApiMethod, Router, RpcEnvironmentType, UserInformation};
|
||||
|
||||
use crate::{ServerAdapter, AuthError, FileLogger, FileLogOptions, CommandSocket, RestEnvironment};
|
||||
|
@ -13,7 +13,7 @@ use anyhow::{bail, format_err, Error};
|
||||
use futures::future::{self, Either};
|
||||
use nix::unistd::{fork, ForkResult};
|
||||
|
||||
use proxmox::tools::fd::{fd_change_cloexec, Fd};
|
||||
use proxmox_sys::fd::{fd_change_cloexec, Fd};
|
||||
use proxmox_io::{ReadExt, WriteExt};
|
||||
|
||||
// Unfortunately FnBox is nightly-only and Box<FnOnce> is unusable, so just use Box<Fn>...
|
||||
@ -129,14 +129,14 @@ impl Reloader {
|
||||
let ident = ident.as_bytes();
|
||||
let fd = unsafe { sd_journal_stream_fd(ident.as_ptr(), libc::LOG_INFO, 1) };
|
||||
if fd >= 0 && fd != 1 {
|
||||
let fd = proxmox::tools::fd::Fd(fd); // add drop handler
|
||||
let fd = proxmox_sys::fd::Fd(fd); // add drop handler
|
||||
nix::unistd::dup2(fd.as_raw_fd(), 1)?;
|
||||
} else {
|
||||
log::error!("failed to update STDOUT journal redirection ({})", fd);
|
||||
}
|
||||
let fd = unsafe { sd_journal_stream_fd(ident.as_ptr(), libc::LOG_ERR, 1) };
|
||||
if fd >= 0 && fd != 2 {
|
||||
let fd = proxmox::tools::fd::Fd(fd); // add drop handler
|
||||
let fd = proxmox_sys::fd::Fd(fd); // add drop handler
|
||||
nix::unistd::dup2(fd.as_raw_fd(), 2)?;
|
||||
} else {
|
||||
log::error!("failed to update STDERR journal redirection ({})", fd);
|
||||
|
@ -3,7 +3,7 @@ use std::io::Write;
|
||||
use anyhow::Error;
|
||||
use nix::fcntl::OFlag;
|
||||
|
||||
use proxmox::tools::fs::{CreateOptions, atomic_open_or_create_file};
|
||||
use proxmox_sys::fs::{CreateOptions, atomic_open_or_create_file};
|
||||
|
||||
/// Options to control the behavior of a [FileLogger] instance
|
||||
#[derive(Default)]
|
||||
|
@ -25,9 +25,9 @@ use hyper::{Body, Response, Method};
|
||||
use http::request::Parts;
|
||||
use http::HeaderMap;
|
||||
|
||||
use proxmox::tools::fd::Fd;
|
||||
use proxmox::sys::linux::procfs::PidStat;
|
||||
use proxmox::tools::fs::CreateOptions;
|
||||
use proxmox_sys::fd::Fd;
|
||||
use proxmox_sys::linux::procfs::PidStat;
|
||||
use proxmox_sys::fs::CreateOptions;
|
||||
use proxmox_router::UserInformation;
|
||||
|
||||
mod compression;
|
||||
@ -117,12 +117,12 @@ pub(crate) fn pstart() -> u64 {
|
||||
/// Helper to write the PID into a file
|
||||
pub fn write_pid(pid_fn: &str) -> Result<(), Error> {
|
||||
let pid_str = format!("{}\n", *PID);
|
||||
proxmox::tools::fs::replace_file(pid_fn, pid_str.as_bytes(), CreateOptions::new(), false)
|
||||
proxmox_sys::fs::replace_file(pid_fn, pid_str.as_bytes(), CreateOptions::new(), false)
|
||||
}
|
||||
|
||||
/// Helper to read the PID from a file
|
||||
pub fn read_pid(pid_fn: &str) -> Result<i32, Error> {
|
||||
let pid = proxmox::tools::fs::file_get_contents(pid_fn)?;
|
||||
let pid = proxmox_sys::fs::file_get_contents(pid_fn)?;
|
||||
let pid = std::str::from_utf8(&pid)?.trim();
|
||||
pid.parse().map_err(|err| format_err!("could not parse pid - {}", err))
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ pub(crate) async fn handle_api_request<Env: RpcEnvironment, S: 'static + BuildHa
|
||||
resp.map(|body| {
|
||||
Body::wrap_stream(DeflateEncoder::with_quality(
|
||||
TryStreamExt::map_err(body, |err| {
|
||||
proxmox::io_format_err!("error during compression: {}", err)
|
||||
proxmox_sys::io_format_err!("error during compression: {}", err)
|
||||
}),
|
||||
Level::Default,
|
||||
))
|
||||
|
@ -16,12 +16,12 @@ use tokio::sync::oneshot;
|
||||
use nix::fcntl::OFlag;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use proxmox::sys::linux::procfs;
|
||||
use proxmox::tools::fs::{create_path, replace_file, atomic_open_or_create_file, CreateOptions};
|
||||
use proxmox_sys::linux::procfs;
|
||||
use proxmox_sys::fs::{create_path, replace_file, atomic_open_or_create_file, CreateOptions};
|
||||
use proxmox_lang::try_block;
|
||||
use proxmox_schema::upid::UPID;
|
||||
|
||||
use proxmox_sys::worker_task_context::{WorkerTaskContext};
|
||||
use proxmox_sys::WorkerTaskContext;
|
||||
use proxmox_sys::logrotate::{LogRotate, LogRotateFiles};
|
||||
|
||||
use crate::{CommandSocket, FileLogger, FileLogOptions};
|
||||
@ -79,7 +79,7 @@ impl WorkerTaskSetup {
|
||||
|
||||
let timeout = std::time::Duration::new(10, 0);
|
||||
|
||||
let file = proxmox::tools::fs::open_file_locked(
|
||||
let file = proxmox_sys::fs::open_file_locked(
|
||||
&self.task_lock_fn,
|
||||
timeout,
|
||||
exclusive,
|
||||
|
Loading…
Reference in New Issue
Block a user