public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion
@ 2023-10-03 14:07 Philipp Hufnagl
  2023-10-12 13:07 ` Dominik Csapak
  2023-10-13 11:30 ` Thomas Lamprecht
  0 siblings, 2 replies; 6+ messages in thread
From: Philipp Hufnagl @ 2023-10-03 14:07 UTC (permalink / raw)
  To: pbs-devel

When a snapshot gets deleted (forgotten), the proxmox backup client
currently returns returns
"Result: {
  "data": null
}"

This feedback may confuse users therefore this patch changes the output
to

"Successfully deleted snapshot <snapshot>"

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
---
 proxmox-backup-client/src/snapshot.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/proxmox-backup-client/src/snapshot.rs b/proxmox-backup-client/src/snapshot.rs
index 4ca8015f..1d985a2e 100644
--- a/proxmox-backup-client/src/snapshot.rs
+++ b/proxmox-backup-client/src/snapshot.rs
@@ -188,13 +188,14 @@ async fn forget_snapshots(param: Value) -> Result<Value, Error> {
 
     let path = format!("api2/json/admin/datastore/{}/snapshots", repo.store());
 
-    let result = client
+    client
         .delete(&path, Some(snapshot_args(&backup_ns, &snapshot)?))
         .await?;
 
     record_repository(&repo);
 
-    Ok(result)
+    println!("Successfully deleted snapshot {}", snapshot);
+    Ok(Value::Null)
 }
 
 #[api(
-- 
2.39.2





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

* Re: [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion
  2023-10-03 14:07 [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion Philipp Hufnagl
@ 2023-10-12 13:07 ` Dominik Csapak
  2023-10-13 11:30 ` Thomas Lamprecht
  1 sibling, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2023-10-12 13:07 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Philipp Hufnagl

LGTM

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>

On 10/3/23 16:07, Philipp Hufnagl wrote:
> When a snapshot gets deleted (forgotten), the proxmox backup client
> currently returns returns
> "Result: {
>    "data": null
> }"
> 
> This feedback may confuse users therefore this patch changes the output
> to
> 
> "Successfully deleted snapshot <snapshot>"
> 
> Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
> ---
>   proxmox-backup-client/src/snapshot.rs | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/proxmox-backup-client/src/snapshot.rs b/proxmox-backup-client/src/snapshot.rs
> index 4ca8015f..1d985a2e 100644
> --- a/proxmox-backup-client/src/snapshot.rs
> +++ b/proxmox-backup-client/src/snapshot.rs
> @@ -188,13 +188,14 @@ async fn forget_snapshots(param: Value) -> Result<Value, Error> {
>   
>       let path = format!("api2/json/admin/datastore/{}/snapshots", repo.store());
>   
> -    let result = client
> +    client
>           .delete(&path, Some(snapshot_args(&backup_ns, &snapshot)?))
>           .await?;
>   
>       record_repository(&repo);
>   
> -    Ok(result)
> +    println!("Successfully deleted snapshot {}", snapshot);
> +    Ok(Value::Null)
>   }
>   
>   #[api(





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

* Re: [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion
  2023-10-03 14:07 [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion Philipp Hufnagl
  2023-10-12 13:07 ` Dominik Csapak
@ 2023-10-13 11:30 ` Thomas Lamprecht
  2023-10-13 14:57   ` Philipp Hufnagl
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Lamprecht @ 2023-10-13 11:30 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Philipp Hufnagl

Am 03/10/2023 um 16:07 schrieb Philipp Hufnagl:
> -    Ok(result)
> +    println!("Successfully deleted snapshot {}", snapshot);

please use inline variables wherever easily possible for new code:

println!("Successfully deleted snapshot {snapshot}");

but I'm not sure if we actually want to print anything here, did you
check what the other "action" (i.e., non-GET ones) do, If they all,
or at least most of them, print such reports too it can be fine, but
otherwise this would add inconsistency and simply doing nothing (i.e.,
exiting with SUCCESS) would be enough.





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

* Re: [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion
  2023-10-13 11:30 ` Thomas Lamprecht
@ 2023-10-13 14:57   ` Philipp Hufnagl
  2023-10-13 16:29     ` Thomas Lamprecht
  0 siblings, 1 reply; 6+ messages in thread
From: Philipp Hufnagl @ 2023-10-13 14:57 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox Backup Server development discussion



On 10/13/23 13:30, Thomas Lamprecht wrote:
> Am 03/10/2023 um 16:07 schrieb Philipp Hufnagl:
>> -    Ok(result)
>> +    println!("Successfully deleted snapshot {}", snapshot);
> 
> please use inline variables wherever easily possible for new code:
> 
> println!("Successfully deleted snapshot {snapshot}");
> 
> but I'm not sure if we actually want to print anything here, did you
> check what the other "action" (i.e., non-GET ones) do, If they all,
> or at least most of them, print such reports too it can be fine, but
> otherwise this would add inconsistency and simply doing nothing (i.e.,
> exiting with SUCCESS) would be enough.
> 

You are right! For example 'proxmox-backup-client snapshot notes
update' does not produce any output. Ill make a v 2 on Monday removing
the output!




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

* Re: [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion
  2023-10-13 14:57   ` Philipp Hufnagl
@ 2023-10-13 16:29     ` Thomas Lamprecht
  2023-10-16 10:48       ` Philipp Hufnagl
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Lamprecht @ 2023-10-13 16:29 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Philipp Hufnagl

Am 13/10/2023 um 16:57 schrieb Philipp Hufnagl:
> On 10/13/23 13:30, Thomas Lamprecht wrote:
>> but I'm not sure if we actually want to print anything here, did you
>> check what the other "action" (i.e., non-GET ones) do, If they all,
>> or at least most of them, print such reports too it can be fine, but
>> otherwise this would add inconsistency and simply doing nothing (i.e.,
>> exiting with SUCCESS) would be enough.
>>
> You are right! For example 'proxmox-backup-client snapshot notes
> update' does not produce any output. Ill make a v 2 on Monday removing
> the output!
> 


FWIW, I do not have anything about outputting such things, especially
if other devs/users thinks that's fine, or even desired too.

But, if we do more such things then a -q/--quiet flag could be nice, e.g.,
to avoid stray output in scripts using those commands.

That said, we can always add such output later after you fixed the weird
Result { null } print, let's keep the scope small for now.




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

* Re: [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion
  2023-10-13 16:29     ` Thomas Lamprecht
@ 2023-10-16 10:48       ` Philipp Hufnagl
  0 siblings, 0 replies; 6+ messages in thread
From: Philipp Hufnagl @ 2023-10-16 10:48 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox Backup Server development discussion



On 10/13/23 18:29, Thomas Lamprecht wrote:
> Am 13/10/2023 um 16:57 schrieb Philipp Hufnagl:
>> On 10/13/23 13:30, Thomas Lamprecht wrote:
>>> but I'm not sure if we actually want to print anything here, did you
>>> check what the other "action" (i.e., non-GET ones) do, If they all,
>>> or at least most of them, print such reports too it can be fine, but
>>> otherwise this would add inconsistency and simply doing nothing (i.e.,
>>> exiting with SUCCESS) would be enough.
>>>
>> You are right! For example 'proxmox-backup-client snapshot notes
>> update' does not produce any output. Ill make a v 2 on Monday removing
>> the output!
>>
> 
> 
> FWIW, I do not have anything about outputting such things, especially
> if other devs/users thinks that's fine, or even desired too.
> 
> But, if we do more such things then a -q/--quiet flag could be nice, e.g.,
> to avoid stray output in scripts using those commands.
> 
> That said, we can always add such output later after you fixed the weird
> Result { null } print, let's keep the scope small for now.

I think you are right here. Since other commands do not output
anything, this command should do that as well for consistency. I think
I should remove the output and we should consider a -v/--verbose flag
in the future.




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

end of thread, other threads:[~2023-10-16 10:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 14:07 [pbs-devel] [PATCH proxmox-backup] fix #4971: client: Improve output on successful snapshot deletion Philipp Hufnagl
2023-10-12 13:07 ` Dominik Csapak
2023-10-13 11:30 ` Thomas Lamprecht
2023-10-13 14:57   ` Philipp Hufnagl
2023-10-13 16:29     ` Thomas Lamprecht
2023-10-16 10:48       ` Philipp Hufnagl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal