[pbs-devel] [PATCH proxmox-backup] reuse-datastore: avoid creating another default prune job
Gabriel Goller
g.goller at proxmox.com
Mon Nov 25 09:58:18 CET 2024
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: {
>
More information about the pbs-devel
mailing list