From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 25CB08A76C for ; Thu, 20 Oct 2022 15:37:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 06599185ED for ; Thu, 20 Oct 2022 15:36:36 +0200 (CEST) Received: from lana.proxmox.com (unknown [94.136.29.99]) by firstgate.proxmox.com (Proxmox) with ESMTP for ; Thu, 20 Oct 2022 15:36:34 +0200 (CEST) Received: by lana.proxmox.com (Postfix, from userid 10043) id 5D64B2C22CA; Thu, 20 Oct 2022 15:36:34 +0200 (CEST) From: Stefan Hanreich To: pbs-devel@lists.proxmox.com Date: Thu, 20 Oct 2022 15:36:30 +0200 Message-Id: <20221020133630.376542-1-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.334 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods NO_DNS_FOR_FROM 0.001 Envelope sender has no MX or A DNS records RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pbs-devel] [PATCH proxmox-backup v2] fix #4301: correctly pass rate limit parameters to API X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2022 13:37:06 -0000 With the old code the rate limit parameters got passed in their own dictionary under the limit key, but the API expects the rate-limit settings as top-level keys. This commit correctly sets the rate-limit parameters so the API actually uses them. Signed-off-by: Stefan Hanreich --- src/bin/proxmox-backup-manager.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs index 58e7e33a..b9bfd701 100644 --- a/src/bin/proxmox-backup-manager.rs +++ b/src/bin/proxmox-backup-manager.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::io::{self, Write}; use std::str::FromStr; -use anyhow::Error; +use anyhow::{Error, format_err}; use serde_json::{json, Value}; use proxmox_router::{cli::*, RpcEnvironment}; @@ -297,7 +297,6 @@ async fn pull_datastore( "store": store, "remote": remote, "remote-store": remote_store, - "limit": limit, }); if remote_ns.is_some() { @@ -320,6 +319,16 @@ async fn pull_datastore( args["remove-vanished"] = Value::from(remove_vanished); } + let mut limit_json = json!(limit); + let limit_map = limit_json + .as_object_mut() + .ok_or_else(|| format_err!("limit is not an Object"))?; + + args + .as_object_mut() + .unwrap() + .append(limit_map); + let result = client.post("api2/json/pull", Some(args)).await?; view_task_result(&client, result, &output_format).await?; -- 2.30.2