mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-27 10:01:38 +00:00
JSONSchema: refactor tag regex
we'll use that elsewhere too Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
ceff9a846c
commit
056bbe2da4
@ -696,12 +696,14 @@ register_standard_option('proxmox-remote', {
|
|||||||
type => 'string', format => 'proxmox-remote',
|
type => 'string', format => 'proxmox-remote',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
our $PVE_TAG_RE = qr/[a-z0-9_][a-z0-9_\-\+\.]*/i;
|
||||||
|
|
||||||
# used for pve-tag-list in e.g., guest configs
|
# used for pve-tag-list in e.g., guest configs
|
||||||
register_format('pve-tag', \&pve_verify_tag);
|
register_format('pve-tag', \&pve_verify_tag);
|
||||||
sub pve_verify_tag {
|
sub pve_verify_tag {
|
||||||
my ($value, $noerr) = @_;
|
my ($value, $noerr) = @_;
|
||||||
|
|
||||||
return $value if $value =~ m/^[a-z0-9_][a-z0-9_\-\+\.]*$/i;
|
return $value if $value =~ m/^${PVE_TAG_RE}$/i;
|
||||||
|
|
||||||
return undef if $noerr;
|
return undef if $noerr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user