src/bin/proxmox-backup-client.rs - garbage-collection: display task log
This commit is contained in:
parent
0ec9e1b010
commit
e5f7def40e
|
@ -536,16 +536,31 @@ fn start_garbage_collection(
|
||||||
) -> Result<Value, Error> {
|
) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
||||||
|
|
||||||
let mut client = HttpClient::new(repo.host(), repo.user(), None)?;
|
let mut client = HttpClient::new(repo.host(), repo.user(), None)?;
|
||||||
|
|
||||||
let path = format!("api2/json/admin/datastore/{}/gc", repo.store());
|
let path = format!("api2/json/admin/datastore/{}/gc", repo.store());
|
||||||
|
|
||||||
let result = async_main(async move { client.post(&path, None).await })?;
|
async_main(async {
|
||||||
|
let result = client.post(&path, None).await?;
|
||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
Ok(result)
|
let data = &result["data"];
|
||||||
|
if output_format == "text" {
|
||||||
|
if let Some(upid) = data.as_str() {
|
||||||
|
display_task_log(client, upid, true).await?;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
format_and_print_result(&data, &output_format);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok::<_, Error>(())
|
||||||
|
})?;
|
||||||
|
|
||||||
|
|
||||||
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_backupspec(value: &str) -> Result<(&str, &str), Error> {
|
fn parse_backupspec(value: &str) -> Result<(&str, &str), Error> {
|
||||||
|
|
Loading…
Reference in New Issue