src/bin/proxmox-backup-client.rs - garbage-collection: display task log

This commit is contained in:
Dietmar Maurer 2019-12-09 13:29:23 +01:00
parent 0ec9e1b010
commit e5f7def40e
1 changed files with 18 additions and 3 deletions

View File

@ -536,16 +536,31 @@ fn start_garbage_collection(
) -> Result<Value, Error> {
let repo = extract_repository_from_value(&param)?;
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
let mut client = HttpClient::new(repo.host(), repo.user(), None)?;
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);
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> {