[pbs-devel] [PATCH proxmox-backup v5 09/22] pbs-api-types: use SchemaDeserializer for maintenance mode

Hannes Laimer h.laimer at proxmox.com
Wed Apr 17 14:23:49 CEST 2024


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 pbs-api-types/src/datastore.rs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index 898149ea..8fefee64 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -6,8 +6,8 @@ use const_format::concatcp;
 use serde::{Deserialize, Serialize};
 
 use proxmox_schema::{
-    api, const_regex, ApiStringFormat, ApiType, ArraySchema, EnumEntry, IntegerSchema, ReturnType,
-    Schema, StringSchema, Updater, UpdaterType,
+    api, const_regex, de::SchemaDeserializer, ApiStringFormat, ApiType, ArraySchema, EnumEntry,
+    IntegerSchema, ReturnType, Schema, StringSchema, Updater, UpdaterType,
 };
 
 use crate::{
@@ -348,10 +348,10 @@ impl DataStoreConfig {
     }
 
     pub fn get_maintenance_mode(&self) -> Option<MaintenanceMode> {
-        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(SchemaDeserializer::new(str, &MaintenanceMode::API_SCHEMA))
+                .ok()
+        })
     }
 }
 
-- 
2.39.2





More information about the pbs-devel mailing list