public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Dominic Jäger" <d.jaeger@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-common 2/3 v2] Make configid regex public
Date: Wed, 28 Oct 2020 11:04:53 +0100	[thread overview]
Message-ID: <20201028100454.313122-2-d.jaeger@proxmox.com> (raw)
In-Reply-To: <20201028100454.313122-1-d.jaeger@proxmox.com>

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
v1->v2: Didn't exist

 src/PVE/JSONSchema.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index e8d7395..29ada5b 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -21,6 +21,8 @@ parse_property_string
 register_standard_option
 );
 
+our $CONFIGID_RE = qr/[a-z][a-z0-9_-]+/i;
+
 # Note: This class implements something similar to JSON schema, but it is not 100% complete.
 # see: http://tools.ietf.org/html/draft-zyp-json-schema-02
 # see: http://json-schema.org/
@@ -177,7 +179,7 @@ register_format('pve-configid', \&pve_verify_configid);
 sub pve_verify_configid {
     my ($id, $noerr) = @_;
 
-    if ($id !~ m/^[a-z][a-z0-9_-]+$/i) {
+    if ($id !~ m/^$CONFIGID_RE$/) {
 	return undef if $noerr;
 	die "invalid configuration ID '$id'\n";
     }
-- 
2.20.1




  reply	other threads:[~2020-10-28 10:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 10:04 [pve-devel] [PATCH pve-common 1/3 v2] Add tests for verify_configid Dominic Jäger
2020-10-28 10:04 ` Dominic Jäger [this message]
2020-10-29 18:15   ` [pve-devel] applied: [PATCH pve-common 2/3 v2] Make configid regex public Thomas Lamprecht
2020-10-28 10:04 ` [pve-devel] [PATCH pve-storage 3/3 v2] lvmthin: Match snapshot remove regex to allowed names Dominic Jäger
2020-11-16 17:26   ` [pve-devel] applied: " Thomas Lamprecht
2020-10-29 18:15 ` [pve-devel] applied: [PATCH pve-common 1/3 v2] Add tests for verify_configid Thomas Lamprecht

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=20201028100454.313122-2-d.jaeger@proxmox.com \
    --to=d.jaeger@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 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