From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common] SectionConfig: check_value: add broader boolean parsing
Date: Thu, 7 Jan 2021 16:24:24 +0100 [thread overview]
Message-ID: <20210107152424.31185-1-a.lauterer@proxmox.com> (raw)
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
reply other threads:[~2021-01-07 15:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210107152424.31185-1-a.lauterer@proxmox.com \
--to=a.lauterer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.