From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 2C7FA1FF380 for ; Fri, 19 Apr 2024 11:42:47 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5C0BD4464; Fri, 19 Apr 2024 11:42:46 +0200 (CEST) Message-ID: <8c3ec95b-cce9-47f1-81e9-7010a8aa7c55@proxmox.com> Date: Fri, 19 Apr 2024 11:42:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox Backup Server development discussion , Dietmar Maurer References: <20240419073750.135595-1-dietmar@proxmox.com> <20240419073750.135595-2-dietmar@proxmox.com> Content-Language: en-US, de-DE From: Christian Ebner In-Reply-To: <20240419073750.135595-2-dietmar@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.031 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 1/3] pbs-api-types: use SchemaDeserializer for maintenance mode 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: , Reply-To: Proxmox Backup Server development discussion Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" On 4/19/24 09:37, Dietmar Maurer wrote: > Signed-off-by: Dietmar Maurer > Signed-off-by: Hannes Laimer > --- > pbs-api-types/src/datastore.rs | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs > index 5e13c157..483cdef4 100644 > --- a/pbs-api-types/src/datastore.rs > +++ b/pbs-api-types/src/datastore.rs > @@ -11,8 +11,8 @@ use proxmox_schema::{ > }; > > use crate::{ > - Authid, CryptMode, Fingerprint, GroupFilter, MaintenanceMode, Userid, BACKUP_ID_RE, > - BACKUP_NS_RE, BACKUP_TIME_RE, BACKUP_TYPE_RE, DATASTORE_NOTIFY_STRING_SCHEMA, > + Authid, CryptMode, Fingerprint, GroupFilter, MaintenanceMode, MaintenanceType, Userid, > + BACKUP_ID_RE, BACKUP_NS_RE, BACKUP_TIME_RE, BACKUP_TYPE_RE, DATASTORE_NOTIFY_STRING_SCHEMA, > GC_SCHEDULE_SCHEMA, GROUP_OR_SNAPSHOT_PATH_REGEX_STR, PROXMOX_SAFE_ID_FORMAT, > PROXMOX_SAFE_ID_REGEX_STR, PRUNE_SCHEDULE_SCHEMA, SHA256_HEX_REGEX, SINGLE_LINE_COMMENT_SCHEMA, > SNAPSHOT_PATH_REGEX_STR, UPID, > @@ -336,10 +336,13 @@ impl DataStoreConfig { > } > > pub fn get_maintenance_mode(&self) -> Option { > - self.maintenance_mode > - .as_ref() > - .and_then(|str| MaintenanceMode::API_SCHEMA.parse_property_string(str).ok()) > - .and_then(|value| MaintenanceMode::deserialize(value).ok()) > + self.maintenance_mode.as_ref().and_then(|str| { > + MaintenanceMode::deserialize(proxmox_schema::de::SchemaDeserializer::new( Should `SchemaDeserializer` be brought into scope by adding it to the already present `proxmox_schema` use statement? > + str, > + &MaintenanceMode::API_SCHEMA, > + )) > + .ok() > + }) > } > } > _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel