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

@ -2,7 +2,7 @@ use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
use proxmox_schema::{api, parse_property_string};
use proxmox_schema::api;
use proxmox_sys::task_log;
use pbs_api_types::{
@ -173,7 +173,7 @@ pub fn create_zpool(
let ashift = ashift.unwrap_or(12);
let devices_text = devices.clone();
let devices = parse_property_string(&devices, &DISK_ARRAY_SCHEMA)?;
let devices = DISK_ARRAY_SCHEMA.parse_property_string(&devices)?;
let devices: Vec<String> = devices.as_array().unwrap().iter()
.map(|v| v.as_str().unwrap().to_string()).collect();

View File

@ -4,7 +4,7 @@ use ::serde::{Deserialize, Serialize};
use hex::FromHex;
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::{api, parse_property_string};
use proxmox_schema::api;
use pbs_api_types::{
Authid, Interface, NetworkInterfaceType, LinuxBondMode, NetworkConfigMethod, BondXmitHashPolicy,
@ -17,7 +17,7 @@ use pbs_config::network::{self, NetworkConfig};
use proxmox_rest_server::WorkerTask;
fn split_interface_list(list: &str) -> Result<Vec<String>, Error> {
let value = parse_property_string(&list, &NETWORK_INTERFACE_ARRAY_SCHEMA)?;
let value = NETWORK_INTERFACE_ARRAY_SCHEMA.parse_property_string(&list)?;
Ok(value.as_array().unwrap().iter().map(|v| v.as_str().unwrap().to_string()).collect())
}