Fix: backup: relax file name matching regex
The rework of the backup file detection logic missed the non-standard file name case. This patch allows to restore backups with different file names. Though the config extraction fails, since the type is unknown. Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
3d10acf89e
commit
4b26f8140d
@ -1394,9 +1394,13 @@ sub archive_info {
|
|||||||
my $info;
|
my $info;
|
||||||
|
|
||||||
my $volid = basename($archive);
|
my $volid = basename($archive);
|
||||||
if ($volid =~ /vzdump-(lxc|openvz|qemu)-\d+-(?:\d{4})_(?:\d{2})_(?:\d{2})-(?:\d{2})_(?:\d{2})_(?:\d{2})\.(tgz$|tar|vma)(?:\.(${\PVE::Storage::Plugin::COMPRESSOR_RE}))?$/) {
|
if ($volid =~ /\.(tgz$|tar|vma)(?:\.(${\PVE::Storage::Plugin::COMPRESSOR_RE}))?$/) {
|
||||||
$info = decompressor_info($2, $3);
|
$info = decompressor_info($1, $2);
|
||||||
$info->{type} = $1;
|
$info->{type} = 'unknown';
|
||||||
|
|
||||||
|
if ($volid =~ /vzdump-(lxc|openvz|qemu)-\d+-(?:\d{4})_(?:\d{2})_(?:\d{2})-(?:\d{2})_(?:\d{2})_(?:\d{2})/) {
|
||||||
|
$info->{type} = $1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
die "ERROR: couldn't determine format and compression type\n";
|
die "ERROR: couldn't determine format and compression type\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,16 @@ my $tests = [
|
|||||||
'compression' => 'gz',
|
'compression' => 'gz',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description => 'Backup archive, none, tgz',
|
||||||
|
archive => "backup/whatever-the-name_is_here.tgz",
|
||||||
|
expected => {
|
||||||
|
'type' => 'unknown',
|
||||||
|
'format' => 'tar',
|
||||||
|
'decompressor' => ['tar', '-z'],
|
||||||
|
'compression' => 'gz',
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
# add new compression fromats to test
|
# add new compression fromats to test
|
||||||
@ -88,7 +98,6 @@ my $non_bkp_suffix = {
|
|||||||
'openvz' => [ 'zip', 'tgz.lzo', 'tar.bz2', 'zip.gz', '', ],
|
'openvz' => [ 'zip', 'tgz.lzo', 'tar.bz2', 'zip.gz', '', ],
|
||||||
'lxc' => [ 'zip', 'tgz.lzo', 'tar.bz2', 'zip.gz', '', ],
|
'lxc' => [ 'zip', 'tgz.lzo', 'tar.bz2', 'zip.gz', '', ],
|
||||||
'qemu' => [ 'vma.xz', 'vms.gz', 'vmx.zst', '', ],
|
'qemu' => [ 'vma.xz', 'vms.gz', 'vmx.zst', '', ],
|
||||||
'none' => [ 'tar.gz', ],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# create tests for failed matches
|
# create tests for failed matches
|
||||||
|
|||||||
Reference in New Issue
Block a user