From b1fd556f3b3d740b3832e46f49e5e3e0166e0d05 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 19 May 2020 14:20:43 +0200 Subject: [PATCH] section_config: fixup fallback schema in parse we also have to fallback to the id_schema of the section_config when we parse it, not only on write Signed-off-by: Dominik Csapak --- proxmox/src/api/section_config.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/proxmox/src/api/section_config.rs b/proxmox/src/api/section_config.rs index 02738300..0b2ce3f8 100644 --- a/proxmox/src/api/section_config.rs +++ b/proxmox/src/api/section_config.rs @@ -333,10 +333,12 @@ impl SectionConfig { if let Some((section_type, section_id)) = (self.parse_section_header)(line) { //println!("OKLINE: type: {} ID: {}", section_type, section_id); if let Some(ref plugin) = self.plugins.get(§ion_type) { - if let Some(id_schema) = plugin.get_id_schema() { - if let Err(err) = parse_simple_value(§ion_id, id_schema) { - bail!("syntax error in section identifier: {}", err.to_string()); - } + let id_schema = match plugin.get_id_schema() { + Some(schema) => schema, + None => self.id_schema, + }; + if let Err(err) = parse_simple_value(§ion_id, id_schema) { + bail!("syntax error in section identifier: {}", err.to_string()); } state = ParseState::InsideSection(plugin, section_id, json!({})); } else {