all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2] fix #4301: correctly pass rate limit parameters to API
@ 2022-10-20 13:36 Stefan Hanreich
  2022-10-20 14:06 ` [pbs-devel] applied: " Wolfgang Bumiller
  2022-10-21 15:31 ` [pbs-devel] " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hanreich @ 2022-10-20 13:36 UTC (permalink / raw)
  To: pbs-devel

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 <s.hanreich@proxmox.com>
---
 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup v2] fix #4301: correctly pass rate limit parameters to API
  2022-10-20 13:36 [pbs-devel] [PATCH proxmox-backup v2] fix #4301: correctly pass rate limit parameters to API Stefan Hanreich
@ 2022-10-20 14:06 ` Wolfgang Bumiller
  2022-10-21 15:31 ` [pbs-devel] " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Bumiller @ 2022-10-20 14:06 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pbs-devel

applied, thanks

On Thu, Oct 20, 2022 at 03:36:30PM +0200, Stefan Hanreich wrote:
> 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 <s.hanreich@proxmox.com>
> ---
>  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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup v2] fix #4301: correctly pass rate limit parameters to API
  2022-10-20 13:36 [pbs-devel] [PATCH proxmox-backup v2] fix #4301: correctly pass rate limit parameters to API Stefan Hanreich
  2022-10-20 14:06 ` [pbs-devel] applied: " Wolfgang Bumiller
@ 2022-10-21 15:31 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2022-10-21 15:31 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Stefan Hanreich

FYI, missing a (short) changelog to the previous patch reviosion, namely...

Am 20/10/2022 um 15:36 schrieb Stefan Hanreich:
> 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 <s.hanreich@proxmox.com>
> ---

.. here

https://pve.proxmox.com/wiki/Developer_Documentation#Versioned_Patches

>  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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-21 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 13:36 [pbs-devel] [PATCH proxmox-backup v2] fix #4301: correctly pass rate limit parameters to API Stefan Hanreich
2022-10-20 14:06 ` [pbs-devel] applied: " Wolfgang Bumiller
2022-10-21 15:31 ` [pbs-devel] " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal