The -sys, -tools and -api crate have now been merged into
the proxmx crate directly. Only macro crates are separate
(but still reexported by the proxmox crate in their
designated locations).
When we need to depend on "parts" of the crate later on
we'll just have to use features.
The reason is mostly that these modules had
inter-dependencies which really make them not independent
enough to be their own crates.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
33 files changed:
pam-sys = "0.5"
percent-encoding = "2.1"
pin-utils = "0.1.0-alpha"
pam-sys = "0.5"
percent-encoding = "2.1"
pin-utils = "0.1.0-alpha"
-proxmox = { version = "0.1.5", features = [ "sortable-macro", "api-macro" ] }
+proxmox = { version = "0.1.7", features = [ "sortable-macro", "api-macro" ] }
#proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] }
#proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro" ] }
regex = "1.2"
#proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] }
#proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro" ] }
regex = "1.2"
pub mod version;
pub mod pull;
pub mod version;
pub mod pull;
-use proxmox::api::list_subdirs_api_method;
use proxmox::api::router::SubdirMap;
use proxmox::api::Router;
use proxmox::api::router::SubdirMap;
use proxmox::api::Router;
+use proxmox::list_subdirs_api_method;
const NODES_ROUTER: Router = Router::new().match_all("node", &node::ROUTER);
const NODES_ROUTER: Router = Router::new().match_all("node", &node::ROUTER);
use serde_json::{json, Value};
use serde_json::{json, Value};
-use proxmox::sortable;
-use proxmox::api::{http_err, list_subdirs_api_method};
-use proxmox::api::router::{Router, SubdirMap};
+use proxmox::api::router::{Router, SubdirMap};
+use proxmox::sortable;
+use proxmox::{http_err, list_subdirs_api_method};
use crate::tools;
use crate::tools::ticket::*;
use crate::tools;
use crate::tools::ticket::*;
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::router::{Router, SubdirMap};
-use proxmox::api::list_subdirs_api_method;
+use proxmox::list_subdirs_api_method;
use hyper::{header, Body, Response, StatusCode};
use serde_json::{json, Value};
use hyper::{header, Body, Response, StatusCode};
use serde_json::{json, Value};
-use proxmox::{sortable, identity};
-use proxmox::api::{http_err, list_subdirs_api_method};
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
-use proxmox::tools::try_block;
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
+use proxmox::try_block;
+use proxmox::{http_err, identity, list_subdirs_api_method, sortable};
use crate::api2::types::*;
use crate::backup::*;
use crate::api2::types::*;
use crate::backup::*;
use hyper::{Body, Response, StatusCode};
use serde_json::{json, Value};
use hyper::{Body, Response, StatusCode};
use serde_json::{json, Value};
-use proxmox::{sortable, identity};
-use proxmox::api::list_subdirs_api_method;
+use proxmox::{sortable, identity, list_subdirs_api_method};
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
break format_err!("uploaded chunk has unexpected size.");
}
break format_err!("uploaded chunk has unexpected size.");
}
- let (is_duplicate, compressed_size) = match proxmox::tools::try_block! {
+ let (is_duplicate, compressed_size) = match proxmox::try_block! {
let mut chunk = DataBlob::from_raw(raw_data)?;
chunk.verify_unencrypted(this.size as usize, &this.digest)?;
let mut chunk = DataBlob::from_raw(raw_data)?;
chunk.verify_unencrypted(this.size as usize, &this.digest)?;
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::router::{Router, SubdirMap};
-use proxmox::api::list_subdirs_api_method;
+use proxmox::list_subdirs_api_method;
pub mod datastore;
pub mod remote;
pub mod datastore;
pub mod remote;
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::router::{Router, SubdirMap};
-use proxmox::api::list_subdirs_api_method;
+use proxmox::list_subdirs_api_method;
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::schema::*;
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::schema::*;
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
-use proxmox::tools::*; // required to use IPRE!() macro ???
+use proxmox::{IPRE, IPV4RE, IPV6RE, IPV4OCTET, IPV6H16, IPV6LS32};
use crate::api2::types::*;
use crate::api2::types::*;
use failure::*;
use serde_json::{json, Value};
use failure::*;
use serde_json::{json, Value};
-use proxmox::{sortable, identity};
-use proxmox::api::list_subdirs_api_method;
+use proxmox::{sortable, identity, list_subdirs_api_method};
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
use proxmox::sys::linux::procfs;
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, SubdirMap};
use proxmox::sys::linux::procfs;
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, SubdirMap};
-use proxmox::api::list_subdirs_api_method;
+use proxmox::list_subdirs_api_method;
use crate::api2::types::*;
use crate::api2::types::*;
use failure::*;
use serde_json::{json, Value};
use failure::*;
use serde_json::{json, Value};
-use proxmox::{sortable, identity};
-use proxmox::api::list_subdirs_api_method;
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
+use proxmox::{identity, list_subdirs_api_method, sortable};
use crate::tools;
use crate::api2::types::*;
use crate::tools;
use crate::api2::types::*;
tmp_manifest_blob.verify_crc()?;
if manifest_name.exists() {
tmp_manifest_blob.verify_crc()?;
if manifest_name.exists() {
- let manifest_blob = proxmox::tools::try_block!({
+ let manifest_blob = proxmox::try_block!({
let mut manifest_file = std::fs::File::open(&manifest_name)
.map_err(|err| format_err!("unable to open local manifest {:?} - {}", manifest_name, err))?;
let mut manifest_file = std::fs::File::open(&manifest_name)
.map_err(|err| format_err!("unable to open local manifest {:?} - {}", manifest_name, err))?;
- let result: Result<(), Error> = proxmox::tools::try_block!({
+ let result: Result<(), Error> = proxmox::try_block!({
let local_groups = BackupGroup::list_groups(&tgt_store.base_path())?;
for local_group in local_groups {
if new_groups.contains(&local_group) { continue; }
let local_groups = BackupGroup::list_groups(&tgt_store.base_path())?;
for local_group in local_groups {
if new_groups.contains(&local_group) { continue; }
use serde_json::Value;
use proxmox::{sortable, identity};
use serde_json::Value;
use proxmox::{sortable, identity};
-use proxmox::api::http_err;
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::schema::*;
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment};
use proxmox::api::schema::*;
use crate::api2::types::*;
use crate::backup::*;
use crate::api2::types::*;
use crate::backup::*;
use failure::*;
use ::serde::{Deserialize, Serialize};
use failure::*;
use ::serde::{Deserialize, Serialize};
-use proxmox::api::{api, const_regex, schema::*};
-use proxmox::tools::*; // required to use IPRE!() macro ???
+use proxmox::api::{api, schema::*};
+use proxmox::const_regex;
+use proxmox::{IPRE, IPV4RE, IPV6RE, IPV4OCTET, IPV6H16, IPV6LS32};
// File names: may not contain slashes, may not start with "."
pub const FILENAME_FORMAT: ApiStringFormat = ApiStringFormat::VerifyFn(|name| {
// File names: may not contain slashes, may not start with "."
pub const FILENAME_FORMAT: ApiStringFormat = ApiStringFormat::VerifyFn(|name| {
-use proxmox::tools::{
- try_block,
- fs::{file_get_contents, replace_file, CreateOptions},
-};
+use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
+use proxmox::try_block;
fn compute_csrf_secret_digest(
timestamp: i64,
fn compute_csrf_secret_digest(
timestamp: i64,
/// accessor to crc32 checksum
pub fn crc(&self) -> u32 {
/// accessor to crc32 checksum
pub fn crc(&self) -> u32 {
- let crc_o = proxmox::tools::offsetof!(DataBlobHeader, crc);
+ let crc_o = proxmox::offsetof!(DataBlobHeader, crc);
u32::from_le_bytes(self.raw_data[crc_o..crc_o+4].try_into().unwrap())
}
// set the CRC checksum field
pub fn set_crc(&mut self, crc: u32) {
u32::from_le_bytes(self.raw_data[crc_o..crc_o+4].try_into().unwrap())
}
// set the CRC checksum field
pub fn set_crc(&mut self, crc: u32) {
- let crc_o = proxmox::tools::offsetof!(DataBlobHeader, crc);
+ let crc_o = proxmox::offsetof!(DataBlobHeader, crc);
self.raw_data[crc_o..crc_o+4].copy_from_slice(&crc.to_le_bytes());
}
self.raw_data[crc_o..crc_o+4].copy_from_slice(&crc.to_le_bytes());
}
pub index_csum: [u8; 32],
reserved: [u8; 4032], // overall size is one page (4096 bytes)
}
pub index_csum: [u8; 32],
reserved: [u8; 4032], // overall size is one page (4096 bytes)
}
-proxmox::tools::static_assert_size!(DynamicIndexHeader, 4096);
+proxmox::static_assert_size!(DynamicIndexHeader, 4096);
// TODO: Once non-Copy unions are stabilized, use:
// union DynamicIndexHeader {
// reserved: [u8; 4096],
// TODO: Once non-Copy unions are stabilized, use:
// union DynamicIndexHeader {
// reserved: [u8; 4096],
- let csum_offset = proxmox::tools::offsetof!(DynamicIndexHeader, index_csum);
+ let csum_offset = proxmox::offsetof!(DynamicIndexHeader, index_csum);
self.writer.seek(SeekFrom::Start(csum_offset as u64))?;
let csum = self.csum.take().unwrap();
self.writer.seek(SeekFrom::Start(csum_offset as u64))?;
let csum = self.csum.take().unwrap();
pub chunk_size: u64,
reserved: [u8; 4016], // overall size is one page (4096 bytes)
}
pub chunk_size: u64,
reserved: [u8; 4016], // overall size is one page (4096 bytes)
}
-proxmox::tools::static_assert_size!(FixedIndexHeader, 4096);
+proxmox::static_assert_size!(FixedIndexHeader, 4096);
// split image into fixed size chunks
// split image into fixed size chunks
- let csum_offset = proxmox::tools::offsetof!(FixedIndexHeader, index_csum);
+ let csum_offset = proxmox::offsetof!(FixedIndexHeader, index_csum);
self.file.seek(SeekFrom::Start(csum_offset as u64))?;
self.file.write_all(&index_csum)?;
self.file.flush()?;
self.file.seek(SeekFrom::Start(csum_offset as u64))?;
self.file.write_all(&index_csum)?;
self.file.flush()?;
use serde::{Deserialize, Serialize};
use chrono::{Local, TimeZone, DateTime};
use serde::{Deserialize, Serialize};
use chrono::{Local, TimeZone, DateTime};
-use proxmox::tools::{
- try_block,
- fs::{file_get_contents, replace_file, CreateOptions},
-};
+use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
+use proxmox::try_block;
#[derive(Deserialize, Serialize, Debug)]
pub enum KeyDerivationConfig {
#[derive(Deserialize, Serialize, Debug)]
pub enum KeyDerivationConfig {
use crate::tools::{required_string_property, required_integer_property, required_array_property};
use crate::tools::{required_string_property, required_integer_property, required_array_property};
- proxmox::tools::try_block!({
let backup_type = required_string_property(&data, "backup-type")?;
let backup_id = required_string_property(&data, "backup-id")?;
let backup_time = required_integer_property(&data, "backup-time")?;
let backup_type = required_string_property(&data, "backup-type")?;
let backup_id = required_string_property(&data, "backup-id")?;
let backup_time = required_integer_property(&data, "backup-time")?;
use failure::*;
use futures::*;
use failure::*;
use futures::*;
-use proxmox::tools::try_block;
use proxmox::api::RpcEnvironmentType;
//use proxmox_backup::tools;
use proxmox::api::RpcEnvironmentType;
//use proxmox_backup::tools;
use futures::*;
use tokio::sync::mpsc;
use futures::*;
use tokio::sync::mpsc;
-proxmox::api::const_regex! {
BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(?:pxar|img|conf|log)):(.+)$";
}
BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(?:pxar|img|conf|log)):(.+)$";
}
let mut list = Vec::new();
let mut list = Vec::new();
- let _ = proxmox::tools::try_block!({
+ let _ = proxmox::try_block!({
let remote = param.get("remote").ok_or_else(|| format_err!("no remote"))?;
let (remote_config, _digest) = remote::config()?;
let remote = param.get("remote").ok_or_else(|| format_err!("no remote"))?;
let (remote_config, _digest) = remote::config()?;
use hyper;
use openssl::ssl::{SslMethod, SslAcceptor, SslFiletype};
use hyper;
use openssl::ssl::{SslMethod, SslAcceptor, SslFiletype};
-use proxmox::tools::try_block;
use proxmox::api::RpcEnvironmentType;
use proxmox_backup::configdir;
use proxmox::api::RpcEnvironmentType;
use proxmox_backup::configdir;
-use proxmox::api::const_regex;
use proxmox::api::schema::*;
use proxmox::api::schema::*;
+use proxmox::const_regex;
const_regex! {
/// Regular expression to parse repository URLs
const_regex! {
/// Regular expression to parse repository URLs
use openssl::pkey::PKey;
use proxmox::tools::fs::{CreateOptions, replace_file};
use openssl::pkey::PKey;
use proxmox::tools::fs::{CreateOptions, replace_file};
-use proxmox::tools::try_block;
use serde::ser::Serialize;
use proxmox::api::schema::*;
use serde::ser::Serialize;
use proxmox::api::schema::*;
-use proxmox::tools::try_block;
pub struct SectionConfigPlugin {
type_name: String,
pub struct SectionConfigPlugin {
type_name: String,
use futures::*;
use hyper::{Body, Request, Response, StatusCode};
use futures::*;
use hyper::{Body, Request, Response, StatusCode};
-use proxmox::api::{http_err, ApiResponseFuture, HttpError, Router, RpcEnvironment};
+use proxmox::api::{ApiResponseFuture, HttpError, Router, RpcEnvironment};
+use proxmox::http_err;
use crate::tools;
use crate::server::formatter::*;
use crate::tools;
use crate::server::formatter::*;
use tokio::time::Instant;
use url::form_urlencoded;
use tokio::time::Instant;
use url::form_urlencoded;
-use proxmox::api::http_err;
use proxmox::api::{ApiHandler, ApiMethod, HttpError};
use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
use proxmox::api::schema::{ObjectSchema, parse_simple_value, verify_json_object, parse_parameter_strings};
use proxmox::api::{ApiHandler, ApiMethod, HttpError};
use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
use proxmox::api::schema::{ObjectSchema, parse_simple_value, verify_json_object, parse_parameter_strings};
use tokio::sync::oneshot;
use proxmox::sys::linux::procfs;
use tokio::sync::oneshot;
use proxmox::sys::linux::procfs;
-use proxmox::tools::{
- try_block,
- fs::{create_path, replace_file, CreateOptions},
-};
+use proxmox::try_block;
+use proxmox::tools::fs::{create_path, replace_file, CreateOptions};
-use proxmox::tools::try_block;
/// Returns whether the current stdin is a tty .
pub fn stdin_isatty() -> bool {
/// Returns whether the current stdin is a tty .
pub fn stdin_isatty() -> bool {