1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-05 15:05:48 +02:00

Skip local repository duplicate check for SFTP.

This check does not make sense for SFTP since the repository will never be local.
This commit is contained in:
Reid Thompson 2024-08-13 01:45:24 -04:00 committed by GitHub
parent 80c9b3001c
commit 04ef43d9ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 23 deletions

View File

@ -13,6 +13,19 @@
<p>Fix permissions when <cmd>restore</cmd> run as root user.</p>
</release-item>
<release-item>
<github-issue id="2418"/>
<github-pull-request id="2421"/>
<release-item-contributor-list>
<release-item-ideator id="anton.kurochkin"/>
<release-item-contributor id="reid.thompson"/>
<release-item-reviewer id="david.steele"/>
</release-item-contributor-list>
<p>Skip local repository duplicate check for <proper>SFTP</proper>.</p>
</release-item>
</release-bug-list>
<release-improvement-list>

View File

@ -96,10 +96,9 @@ cfgLoadUpdateOption(void)
{
for (unsigned int optionIdx = 0; optionIdx < cfgOptionGroupIdxTotal(cfgOptGrpRepo); optionIdx++)
{
// If the repo is local and either posix, cifs or sftp
// If the repo is local and either posix or cifs
if (!cfgOptionIdxTest(cfgOptRepoHost, optionIdx) &&
(cfgOptionIdxStrId(cfgOptRepoType, optionIdx) == STORAGE_POSIX_TYPE ||
cfgOptionIdxStrId(cfgOptRepoType, optionIdx) == STORAGE_SFTP_TYPE ||
cfgOptionIdxStrId(cfgOptRepoType, optionIdx) == STORAGE_CIFS_TYPE))
{
// Ensure a local repo does not have the same path as another local repo of the same type

View File

@ -118,27 +118,6 @@ testRun(void)
"local repo1 and repo2 paths are both '/var/lib/pgbackrest' but must be different");
// -------------------------------------------------------------------------------------------------------------------------
#ifdef HAVE_LIBSSH2
TEST_TITLE("local default repo paths for sftp repo type must be different");
argList = strLstNew();
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
hrnCfgArgKeyRawStrId(argList, cfgOptRepoType, 1, STORAGE_SFTP_TYPE);
hrnCfgArgKeyRawStrId(argList, cfgOptRepoType, 2, STORAGE_SFTP_TYPE);
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpHostUser, 1, "user1");
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpHostUser, 2, "user2");
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpHost, 1, "host1");
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpHost, 2, "host2");
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpHostKeyHashType, 1, "sha1");
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpHostKeyHashType, 2, "md5");
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpPrivateKeyFile, 1, "/keyfile1");
hrnCfgArgKeyRawZ(argList, cfgOptRepoSftpPrivateKeyFile, 2, "/keyfile2");
TEST_ERROR(
hrnCfgLoadP(cfgCmdInfo, argList), OptionInvalidValueError,
"local repo1 and repo2 paths are both '/var/lib/pgbackrest' but must be different");
#endif // HAVE_LIBSSH2
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("local repo paths same but types different");
argList = strLstNew();