my $info;
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}))?$/) {
- $info = decompressor_info($2, $3);
- $info->{type} = $1;
+ if ($volid =~ /\.(tgz$|tar|vma)(?:\.(${\PVE::Storage::Plugin::COMPRESSOR_RE}))?$/) {
+ $info = decompressor_info($1, $2);
+ $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 {
die "ERROR: couldn't determine format and compression type\n";
}
'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
'openvz' => [ 'zip', 'tgz.lzo', 'tar.bz2', 'zip.gz', '', ],
'lxc' => [ 'zip', 'tgz.lzo', 'tar.bz2', 'zip.gz', '', ],
'qemu' => [ 'vma.xz', 'vms.gz', 'vmx.zst', '', ],
- 'none' => [ 'tar.gz', ],
};
# create tests for failed matches