[pbs-devel] [PATCH proxmox-backup v6 02/23] pbs-api-types: use SchemaDeserializer for maintenance mode
Hannes Laimer
h.laimer at proxmox.com
Thu Apr 18 16:29:10 CEST 2024
From: Dietmar Maurer <dietmar at proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
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 df836566..72b5a15c 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::{
@@ -336,10 +336,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()
+ })
}
pub fn set_maintenance_mode(&mut self, new_mode: Option<MaintenanceMode>) -> Result<(), Error> {
--
2.39.2
More information about the pbs-devel
mailing list