1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Allow file keys to be validated on remove.

This commit is contained in:
David Steele 2015-01-21 13:57:58 -05:00
parent ba7a939798
commit ade9ad78b4

View File

@ -291,7 +291,7 @@ sub remove
my $oManifest = $self->{oManifest};
# Make sure the keys are valid
# $self->valid($strSection, $strKey, $strSubKey);
$self->valid($strSection, $strKey, $strSubKey, undef, true);
if (defined($strSubKey))
{
@ -314,6 +314,8 @@ sub valid
my $strSection = shift;
my $strKey = shift;
my $strSubKey = shift;
my $strValue = shift;
my $bDelete = shift;
# Section and key must always be defined
if (!defined($strSection) || !defined($strKey))
@ -321,8 +323,16 @@ sub valid
confess &log(ASSERT, 'section or key is not defined');
}
# Default bDelete
$bDelete = defined($bDelete) ? $bDelete : false;
if ($strSection =~ /^.*\:(file|path|link)$/ && $strSection !~ /^backup\:path$/)
{
if (!defined($strSubKey) && $bDelete)
{
return true;
}
my $strPath = (split(':', $strSection))[0];
my $strType = (split(':', $strSection))[1];