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

Update Perl repo rules to work when stanza is not specified.

The C storage object strives to use rules whenever possible instead of generating absolute paths.  This change helps the C and Perl storage work together via the protocol layer.
This commit is contained in:
David Steele 2019-01-16 18:45:19 +02:00
parent 0014e15944
commit b4146b6bff
2 changed files with 16 additions and 17 deletions

View File

@ -45,6 +45,10 @@
<p>Return <code>UnknownError</code> from <code>errorTypeFromCode()</code> for invalid error codes.</p>
</release-item>
<release-item>
<p>Update Perl repo rules to work when stanza is not specified.</p>
</release-item>
<release-item>
<p>Null-terminate list returned by <code>strLstPtr()</code>.</p>
</release-item>

View File

@ -96,7 +96,7 @@ sub storageRepoRule
# Return archive path
if ($strRule eq STORAGE_REPO_ARCHIVE)
{
$strResultFile = "archive/${strStanza}";
$strResultFile = "archive" . (defined($strStanza) ? "/${strStanza}" : '');
# If file is not defined nothing further to do
if (defined($strFile))
@ -118,7 +118,7 @@ sub storageRepoRule
# Return backup path
elsif ($strRule eq STORAGE_REPO_BACKUP)
{
$strResultFile = "backup/${strStanza}" . (defined($strFile) ? "/${strFile}" : '');
$strResultFile = "backup" . (defined($strStanza) ? "/${strStanza}" : '') . (defined($strFile) ? "/${strFile}" : '');
}
# Else error
else
@ -164,23 +164,18 @@ sub storageRepo
if (isRepoLocal())
{
# Path rules
my $hRule;
if ($strStanza ne STORAGE_REPO)
my $hRule =
{
$hRule =
&STORAGE_REPO_ARCHIVE =>
{
&STORAGE_REPO_ARCHIVE =>
{
fnRule => \&storageRepoRule,
xData => $strStanza,
},
&STORAGE_REPO_BACKUP =>
{
fnRule => \&storageRepoRule,
xData => $strStanza,
},
}
fnRule => \&storageRepoRule,
xData => $strStanza eq STORAGE_REPO ? undef : $strStanza,
},
&STORAGE_REPO_BACKUP =>
{
fnRule => \&storageRepoRule,
xData => $strStanza eq STORAGE_REPO ? undef : $strStanza,
},
};
# Create the driver