manager: report: call method directly, avoid HTTPS request

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-11-03 17:23:43 +01:00
parent 9a556c8a30
commit 941342f70e
1 changed files with 3 additions and 9 deletions

View File

@ -1,4 +1,5 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::io::{self, Write};
use anyhow::{format_err, Error}; use anyhow::{format_err, Error};
use serde_json::{json, Value}; use serde_json::{json, Value};
@ -357,15 +358,8 @@ async fn verify(
#[api()] #[api()]
/// System report /// System report
async fn report() -> Result<Value, Error> { async fn report() -> Result<Value, Error> {
let client = connect()?; let report = proxmox_backup::server::generate_report();
io::stdout().write_all(report.as_bytes())?;
let path = format!("api2/json/nodes/localhost/report");
let result = client.get(&path, None).await?;
let data = &result["data"];
println!("{}",data.to_string().replace("\\n", "\n"));
Ok(Value::Null) Ok(Value::Null)
} }