1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-18 23:57:33 +02:00

Add repoIsLocalVerify() to verify repository locality.

Some commands can only be run on a host where the repository is local.  This function centralizes the check and error.

Contributed by Cynthia Shang.
This commit is contained in:
Cynthia Shang
2019-08-21 11:41:36 -04:00
committed by David Steele
parent 6a09d9294d
commit 27e8235812
3 changed files with 17 additions and 0 deletions

View File

@ -75,6 +75,7 @@ testRun(void)
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
TEST_RESULT_BOOL(repoIsLocal(), true, "repo is local");
TEST_RESULT_VOID(repoIsLocalVerify(), " local verified");
// -------------------------------------------------------------------------------------------------------------------------
argList = strLstNew();
@ -85,6 +86,7 @@ testRun(void)
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
TEST_RESULT_BOOL(repoIsLocal(), false, "repo is remote");
TEST_ERROR_FMT(repoIsLocalVerify(), HostInvalidError, "archive-get command must be run on the repository host");
// -------------------------------------------------------------------------------------------------------------------------
argList = strLstNew();