switch to new schema verify methods

the deprecated ones only forward to the new ones anyway..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-12-29 10:53:25 +01:00
parent 2d9fbc02ab
commit d363fb2bee
4 changed files with 7 additions and 7 deletions

View File

@ -23,7 +23,7 @@ rustyline = { version = "7", optional = true }
libc = { version = "0.2", optional = true }
proxmox-lang = { path = "../proxmox-lang", version = "1.0" }
proxmox-schema = { path = "../proxmox-schema", version = "1.0" }
proxmox-schema = { path = "../proxmox-schema", version = "1.1" }
[features]
default = [ "cli" ]

View File

@ -192,7 +192,7 @@ pub fn parse_arguments<T: AsRef<str>>(
data.push((name.to_string(), value.to_string()));
}
let options = parse_parameter_strings(&data, schema, true)?;
let options = schema.parse_parameter_strings(&data, true)?;
Ok((options, remaining))
}

View File

@ -14,6 +14,6 @@ hex = "0.4"
serde = "1.0"
serde_json = "1.0"
proxmox-schema = { path = "../proxmox-schema", version = "1.0.0" }
proxmox-schema = { path = "../proxmox-schema", version = "1.1" }
# FIXME: remove!
proxmox-lang = { path = "../proxmox-lang", version = "1.0.0" }

View File

@ -325,13 +325,13 @@ impl SectionConfig {
let plugin = self.plugins.get(type_name).unwrap();
let id_schema = plugin.get_id_schema().unwrap_or(self.id_schema);
if let Err(err) = parse_simple_value(section_id, id_schema) {
if let Err(err) = id_schema.parse_simple_value(section_id) {
bail!("syntax error in section identifier: {}", err.to_string());
}
if section_id.chars().any(|c| c.is_control()) {
bail!("detected unexpected control character in section ID.");
}
if let Err(err) = verify_json_object(section_config, plugin.properties) {
if let Err(err) = plugin.properties.verify_json(section_config) {
bail!("verify section '{}' failed - {}", section_id, err);
}
@ -405,7 +405,7 @@ impl SectionConfig {
if let Some(plugin) = self.plugins.get(&section_type) {
let id_schema =
plugin.get_id_schema().unwrap_or(self.id_schema);
if let Err(err) = parse_simple_value(&section_id, id_schema) {
if let Err(err) = id_schema.parse_simple_value(&section_id) {
bail!(
"syntax error in section identifier: {}",
err.to_string()
@ -449,7 +449,7 @@ impl SectionConfig {
None => bail!("unknown property '{}'", key),
};
let value = match parse_simple_value(&value, prop_schema) {
let value = match prop_schema.parse_simple_value(&value) {
Ok(value) => value,
Err(err) => {
bail!("property '{}': {}", key, err.to_string());