[pve-devel] [PATCH common] SectionConfig: check_value: add broader boolean parsing

Aaron Lauterer a.lauterer at proxmox.com
Thu Jan 7 16:24:24 CET 2021

In other config parsers we already allow the use of yes,on,true and
their negative counterparts for booleans.

Adding the JSONSchema::parse_boolean here aligns this behavior to all
the config files that use SectionConfig.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
SectionConfig is used for quite a few "internal" config files.
One major example that users edit manually quite a bit is the

 src/PVE/SectionConfig.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm
index af0af03..5cf0a6f 100644
--- a/src/PVE/SectionConfig.pm
+++ b/src/PVE/SectionConfig.pm
@@ -248,6 +248,8 @@ sub check_value {
     $value = 1 if $ct eq 'boolean' && !defined($value);
+    $value = PVE::JSONSchema::parse_boolean($value) if $ct eq 'boolean';
     die "got undefined value\n" if !defined($value);
     die "property contains a line feed\n" if $value =~ m/[\n\r]/;

More information about the pve-devel mailing list