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,
debug: bool,
) -> Result<Arc<BackupReader>, Error> {
let param = json!({
"backup-ns": backup.ns(),
let mut param = json!({
"backup-type": backup.ty(),
"backup-id": backup.id(),
"backup-time": backup.time,
"store": datastore,
"debug": debug,
});
let ns = backup.ns();
if !ns.is_root() {
param["backup-ns"] = serde_json::to_value(ns)?;
}
let req = HttpClient::request_builder(
client.server(),
client.port(),

View File

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