bump proxmox crate to 0.1.7

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>
This commit is contained in:
Wolfgang Bumiller 2020-01-21 12:28:01 +01:00
parent e881b8a5ef
commit 9ea4bce444
33 changed files with 46 additions and 54 deletions

View File

@ -34,7 +34,7 @@ pam = "0.7"
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"

View File

@ -9,9 +9,9 @@ pub mod types;
pub mod version;
pub mod pull;
use proxmox::api::list_subdirs_api_method;
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);

View File

@ -2,10 +2,10 @@ use failure::*;
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::api;
use proxmox::api::router::{Router, SubdirMap};
use proxmox::sortable;
use proxmox::{http_err, list_subdirs_api_method};
use crate::tools;
use crate::tools::ticket::*;

View File

@ -1,5 +1,5 @@
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::list_subdirs_api_method;
use proxmox::list_subdirs_api_method;
pub mod datastore;

View File

@ -7,14 +7,13 @@ use hyper::http::request::Parts;
use hyper::{header, Body, Response, StatusCode};
use serde_json::{json, Value};
use proxmox::{sortable, identity};
use proxmox::api::api;
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::tools::try_block;
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::*;

View File

@ -5,8 +5,7 @@ use hyper::http::request::Parts;
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::*;

View File

@ -58,7 +58,7 @@ impl Future for UploadChunk {
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)?;

View File

@ -1,5 +1,5 @@
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;

View File

@ -1,5 +1,5 @@
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::list_subdirs_api_method;
use proxmox::list_subdirs_api_method;
mod tasks;
mod time;

View File

@ -10,7 +10,7 @@ use proxmox::{sortable, identity};
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::*;

View File

@ -3,8 +3,7 @@ use std::process::{Command, Stdio};
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::*;

View File

@ -4,7 +4,7 @@ use serde_json::{json, Value};
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::*;

View File

@ -4,11 +4,10 @@ use std::io::{BufRead, BufReader};
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::{identity, list_subdirs_api_method, sortable};
use crate::tools;
use crate::api2::types::*;

View File

@ -128,7 +128,7 @@ async fn pull_snapshot(
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))?;
@ -331,7 +331,7 @@ pub async fn pull_store(
}
if delete {
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; }

View File

@ -7,9 +7,9 @@ use hyper::{Body, Response, StatusCode};
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::http_err;
use crate::api2::types::*;
use crate::backup::*;

View File

@ -1,8 +1,9 @@
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| {

View File

@ -7,10 +7,8 @@ use openssl::sha;
use std::path::PathBuf;
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,

View File

@ -48,13 +48,13 @@ impl DataBlob {
/// 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) {
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());
}

View File

@ -29,7 +29,7 @@ pub struct DynamicIndexHeader {
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],
@ -493,7 +493,7 @@ impl DynamicIndexWriter {
self.writer.flush()?;
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();

View File

@ -32,7 +32,7 @@ pub struct FixedIndexHeader {
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
@ -372,7 +372,7 @@ impl FixedIndexWriter {
self.unmap()?;
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()?;

View File

@ -3,10 +3,8 @@ use failure::*;
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 {

View File

@ -119,7 +119,7 @@ impl TryFrom<Value> for BackupManifest {
use crate::tools::{required_string_property, required_integer_property, required_array_property};
proxmox::tools::try_block!({
proxmox::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")?;

View File

@ -1,7 +1,7 @@
use failure::*;
use futures::*;
use proxmox::tools::try_block;
use proxmox::try_block;
use proxmox::api::RpcEnvironmentType;
//use proxmox_backup::tools;

View File

@ -35,7 +35,7 @@ use xdg::BaseDirectories;
use futures::*;
use tokio::sync::mpsc;
proxmox::api::const_regex! {
proxmox::const_regex! {
BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(?:pxar|img|conf|log)):(.+)$";
}

View File

@ -467,7 +467,7 @@ pub fn complete_remote_datastore_name(_arg: &str, param: &HashMap<String, String
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()?;

View File

@ -5,7 +5,7 @@ use futures::*;
use hyper;
use openssl::ssl::{SslMethod, SslAcceptor, SslFiletype};
use proxmox::tools::try_block;
use proxmox::try_block;
use proxmox::api::RpcEnvironmentType;
use proxmox_backup::configdir;

View File

@ -2,8 +2,8 @@ use std::fmt;
use failure::*;
use proxmox::api::const_regex;
use proxmox::api::schema::*;
use proxmox::const_regex;
const_regex! {
/// Regular expression to parse repository URLs

View File

@ -11,7 +11,7 @@ use openssl::x509::{X509Builder};
use openssl::pkey::PKey;
use proxmox::tools::fs::{CreateOptions, replace_file};
use proxmox::tools::try_block;
use proxmox::try_block;
use crate::buildcfg;

View File

@ -9,7 +9,7 @@ use serde::de::DeserializeOwned;
use serde::ser::Serialize;
use proxmox::api::schema::*;
use proxmox::tools::try_block;
use proxmox::try_block;
pub struct SectionConfigPlugin {
type_name: String,

View File

@ -7,7 +7,8 @@ use std::task::{Context, Poll};
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::*;

View File

@ -17,7 +17,7 @@ use tokio::fs::File;
use tokio::time::Instant;
use url::form_urlencoded;
use proxmox::api::http_err;
use proxmox::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};

View File

@ -14,10 +14,8 @@ use serde_json::{json, Value};
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 super::UPID;

View File

@ -6,7 +6,7 @@ use std::os::unix::io::AsRawFd;
use failure::*;
use proxmox::tools::try_block;
use proxmox::try_block;
/// Returns whether the current stdin is a tty .
pub fn stdin_isatty() -> bool {