use new proxmox-async crate

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer
2021-11-19 17:36:06 +01:00
parent ea67cd70c9
commit 9a1b24b6b1
56 changed files with 66 additions and 1686 deletions

View File

@ -21,7 +21,7 @@ use proxmox_backup::config;
fn main() {
proxmox_backup::tools::setup_safe_path_env();
if let Err(err) = pbs_runtime::main(run()) {
if let Err(err) = proxmox_async::runtime::main(run()) {
eprintln!("Error: {}", err);
std::process::exit(-1);
}

View File

@ -20,5 +20,5 @@ fn main() {
let mut rpcenv = CliEnvironment::new();
rpcenv.set_auth_id(Some(format!("{}@pam", username)));
run_cli_command(cmd_def, rpcenv, Some(|future| pbs_runtime::main(future)));
run_cli_command(cmd_def, rpcenv, Some(|future| proxmox_async::runtime::main(future)));
}

View File

@ -440,7 +440,7 @@ fn main() -> Result<(), Error> {
proxmox_backup::tools::setup_safe_path_env();
pbs_runtime::main(run())
proxmox_async::runtime::main(run())
}
fn get_sync_job(id: &String) -> Result<SyncJobConfig, Error> {
@ -499,7 +499,7 @@ pub fn complete_remote_datastore_name(_arg: &str, param: &HashMap<String, String
let mut list = Vec::new();
if let Some(remote) = get_remote(param) {
if let Ok(data) = pbs_runtime::block_on(async move {
if let Ok(data) = proxmox_async::runtime::block_on(async move {
crate::api2::config::remote::scan_remote_datastores(remote).await
}) {
@ -518,7 +518,7 @@ pub fn complete_remote_datastore_group(_arg: &str, param: &HashMap<String, Strin
let mut list = Vec::new();
if let Some((remote, remote_store)) = get_remote_store(param) {
if let Ok(data) = pbs_runtime::block_on(async move {
if let Ok(data) = proxmox_async::runtime::block_on(async move {
crate::api2::config::remote::scan_remote_groups(remote.clone(), remote_store.clone()).await
}) {

View File

@ -85,7 +85,7 @@ fn main() -> Result<(), Error> {
bail!("proxy not running as backup user or group (got uid {} gid {})", running_uid, running_gid);
}
pbs_runtime::main(run())
proxmox_async::runtime::main(run())
}
@ -845,7 +845,7 @@ async fn schedule_task_log_rotate() {
if logrotate.rotate(max_size)? {
println!("rotated access log, telling daemons to re-open log file");
pbs_runtime::block_on(command_reopen_access_logfiles())?;
proxmox_async::runtime::block_on(command_reopen_access_logfiles())?;
task_log!(worker, "API access log was rotated");
} else {
task_log!(worker, "API access log was not rotated");
@ -860,7 +860,7 @@ async fn schedule_task_log_rotate() {
if logrotate.rotate(max_size)? {
println!("rotated auth log, telling daemons to re-open log file");
pbs_runtime::block_on(command_reopen_auth_logfiles())?;
proxmox_async::runtime::block_on(command_reopen_auth_logfiles())?;
task_log!(worker, "API authentication log was rotated");
} else {
task_log!(worker, "API authentication log was not rotated");

View File

@ -104,7 +104,7 @@ fn main() {
let mut rpcenv = CliEnvironment::new();
rpcenv.set_auth_id(Some(String::from("root@pam")));
if let Err(err) = pbs_runtime::main(run(&mut rpcenv)) {
if let Err(err) = proxmox_async::runtime::main(run(&mut rpcenv)) {
eprintln!("error during update: {}", err);
std::process::exit(1);
}

View File

@ -74,7 +74,7 @@ pub fn complete_datastore_group_filter(_arg: &str, param: &HashMap<String, Strin
list.push("type:vm".to_string());
if let Some(store) = param.get("store") {
let groups = pbs_runtime::block_on(async { get_backup_groups(store).await });
let groups = proxmox_async::runtime::block_on(async { get_backup_groups(store).await });
if let Ok(groups) = groups {
list.extend(groups.iter().map(|group| format!("group:{}/{}", group.backup_type, group.backup_id)));
}
@ -1135,5 +1135,5 @@ fn main() {
let mut rpcenv = CliEnvironment::new();
rpcenv.set_auth_id(Some(String::from("root@pam")));
pbs_runtime::main(run_async_cli_command(cmd_def, rpcenv));
proxmox_async::runtime::main(run_async_cli_command(cmd_def, rpcenv));
}

View File

@ -23,7 +23,7 @@ const URL_ASCIISET: percent_encoding::AsciiSet = percent_encoding::NON_ALPHANUME
macro_rules! complete_api_path {
($capability:expr) => {
|complete_me: &str, _map: &HashMap<String, String>| {
pbs_runtime::block_on(async { complete_api_path_do(complete_me, $capability).await })
proxmox_async::runtime::block_on(async { complete_api_path_do(complete_me, $capability).await })
}
};
}