pbs-client: don't include empty backup-ns in requests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-04-27 14:55:58 +02:00 committed by Thomas Lamprecht
parent 68857aecb3
commit c18d481fd7
2 changed files with 13 additions and 4 deletions

View File

@ -50,14 +50,19 @@ impl BackupReader {
backup: &BackupDir, backup: &BackupDir,
debug: bool, debug: bool,
) -> Result<Arc<BackupReader>, Error> { ) -> Result<Arc<BackupReader>, Error> {
let param = json!({ let mut param = json!({
"backup-ns": backup.ns(),
"backup-type": backup.ty(), "backup-type": backup.ty(),
"backup-id": backup.id(), "backup-id": backup.id(),
"backup-time": backup.time, "backup-time": backup.time,
"store": datastore, "store": datastore,
"debug": debug, "debug": debug,
}); });
let ns = backup.ns();
if !ns.is_root() {
param["backup-ns"] = serde_json::to_value(ns)?;
}
let req = HttpClient::request_builder( let req = HttpClient::request_builder(
client.server(), client.server(),
client.port(), client.port(),

View File

@ -90,8 +90,7 @@ impl BackupWriter {
debug: bool, debug: bool,
benchmark: bool, benchmark: bool,
) -> Result<Arc<BackupWriter>, Error> { ) -> Result<Arc<BackupWriter>, Error> {
let param = json!({ let mut param = json!({
"backup-ns": backup.ns(),
"backup-type": backup.ty(), "backup-type": backup.ty(),
"backup-id": backup.id(), "backup-id": backup.id(),
"backup-time": backup.time, "backup-time": backup.time,
@ -100,6 +99,11 @@ impl BackupWriter {
"benchmark": benchmark "benchmark": benchmark
}); });
let ns = backup.ns();
if !ns.is_root() {
param["backup-ns"] = serde_json::to_value(ns)?;
}
let req = HttpClient::request_builder( let req = HttpClient::request_builder(
client.server(), client.server(),
client.port(), client.port(),