public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common] SectionConfig: check_value: add broader boolean parsing
@ 2021-01-07 15:24 Aaron Lauterer
  0 siblings, 0 replies; only message in thread
From: Aaron Lauterer @ 2021-01-07 15:24 UTC (permalink / raw)
  To: pve-devel

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@proxmox.com>
---
SectionConfig is used for quite a few "internal" config files.
One major example that users edit manually quite a bit is the
storage.cfg

 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]/;
-- 
2.20.1





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-07 15:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 15:24 [pve-devel] [PATCH common] SectionConfig: check_value: add broader boolean parsing Aaron Lauterer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal