public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>
Cc: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] reuse-datastore: avoid creating another default prune job
Date: Mon, 25 Nov 2024 09:58:18 +0100	[thread overview]
Message-ID: <ddw66rwai2qyctk4boo445w34izp56va6nm3o5hsb6bxcgffot@qat5fdi7nuy6> (raw)
In-Reply-To: <3cc8bcda-9bc6-4658-9c9f-cfad4ef38833@proxmox.com>

On 22.11.2024 12:18, Christian Ebner wrote:
>On 11/22/24 12:11, Gabriel Goller wrote:
>>diff --git a/src/api2/config/prune.rs b/src/api2/config/prune.rs
>>index ce7b8ce565ce..dafb97e2f1e5 100644
>>--- a/src/api2/config/prune.rs
>>+++ b/src/api2/config/prune.rs
>>@@ -77,6 +77,21 @@ pub fn do_create_prune_job(config: PruneJobConfig) -> Result<(), Error> {
>>      Ok(())
>>  }
>>+pub fn default_prune_job_existing(datastore: &str) -> Result<bool, Error> {
>>+    let (section_config, _digest) = prune::config()?;
>>+    if section_config
>>+        .sections
>>+        .keys()
>>+        .filter(|s| s.starts_with(&format!("default-{datastore}")))
>>+        .count()
>>+        > 0
>>+    {
>>+        Ok(true)
>>+    } else {
>>+        Ok(false)
>>+    }
>
>could be more compact? no need for the if block:
>
>let has_default = section_config.sections.keys().filter(...).count() >
>0;
>Ok(has_default)

Yep, corrected it in v2!
Thanks for looking at it!

>>+}
>>+
>>  #[api(
>>      protected: true,
>>      input: {
>


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


      reply	other threads:[~2024-11-25  8:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22 11:11 Gabriel Goller
2024-11-22 11:18 ` Christian Ebner
2024-11-25  8:58   ` Gabriel Goller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ddw66rwai2qyctk4boo445w34izp56va6nm3o5hsb6bxcgffot@qat5fdi7nuy6 \
    --to=g.goller@proxmox.com \
    --cc=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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