factoring out regex for vztmpl
stores the regex definition in PVE::Storage. One test had to be adapted because it tested obsolete code. Namely: it expects vztmpl to only end with .tar.gz, but the new regex also includes .tar.xz, there is nothing against allowing .tar.xz files as vztmpl files. Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
339a4eb3c0
commit
bba10cf4af
@ -101,6 +101,8 @@ PVE::Storage::Plugin->init();
|
||||
|
||||
our $iso_extension_re = qr/\.(?:iso|img)/i;
|
||||
|
||||
our $vztmpl_extension_re = qr/\.tar\.([gx]z)/i;
|
||||
|
||||
# PVE::Storage utility functions
|
||||
|
||||
sub config {
|
||||
@ -573,7 +575,7 @@ sub path_to_volume_id {
|
||||
} elsif ($path =~ m!^$isodir/([^/]+$iso_extension_re)$!) {
|
||||
my $name = $1;
|
||||
return ('iso', "$sid:iso/$name");
|
||||
} elsif ($path =~ m!^$tmpldir/([^/]+\.tar\.gz)$!) {
|
||||
} elsif ($path =~ m!^$tmpldir/([^/]+$vztmpl_extension_re)$!) {
|
||||
my $name = $1;
|
||||
return ('vztmpl', "$sid:vztmpl/$name");
|
||||
} elsif ($path =~ m!^$privatedir/(\d+)$!) {
|
||||
|
||||
Reference in New Issue
Block a user