cleanup schema function calls

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2021-12-16 11:02:53 +01:00
parent 821aa8eae6
commit 9fa3026a08
14 changed files with 34 additions and 45 deletions

View File

@ -4,7 +4,7 @@ use serde_json::Value;
use hex::FromHex;
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::{api, parse_property_string};
use proxmox_schema::api;
use pbs_api_types::{
Authid, ScsiTapeChanger, ScsiTapeChangerUpdater, LtoTapeDrive,
@ -205,9 +205,7 @@ pub fn update_changer(
}
if let Some(export_slots) = update.export_slots {
let slots: Value = parse_property_string(
&export_slots, &SLOT_ARRAY_SCHEMA
)?;
let slots: Value = SLOT_ARRAY_SCHEMA.parse_property_string(&export_slots)?;
let mut slots: Vec<String> = slots
.as_array()
.unwrap()

View File

@ -6,7 +6,7 @@ use ::serde::{Deserialize, Serialize};
use hex::FromHex;
use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
use proxmox_schema::{api, ApiType, parse_property_string};
use proxmox_schema::{api, ApiType};
use proxmox_section_config::SectionConfigData;
use proxmox_sys::WorkerTaskContext;
@ -283,7 +283,7 @@ pub fn update_datastore(
if update.keep_yearly.is_some() { data.keep_yearly = update.keep_yearly; }
if let Some(notify_str) = update.notify {
let value = parse_property_string(&notify_str, &DatastoreNotify::API_SCHEMA)?;
let value = DatastoreNotify::API_SCHEMA.parse_property_string(&notify_str)?;
let notify: DatastoreNotify = serde_json::from_value(value)?;
if let DatastoreNotify { gc: None, verify: None, sync: None } = notify {
data.notify = None;