1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +02:00

Error when archive-get/archive-push/restore are not run on a PostgreSQL host.

This error was lost during the migration to C.  The error that occurred instead (generally an SSH auth error) was hard to debug.

Restore the original behavior by throwing an error immediately if pg1-host is configured for any of these commands.  reset-pg1-host can be used to suppress the error when required.
This commit is contained in:
David Steele
2020-02-12 17:18:48 -07:00
parent dac8119bf1
commit 6353e9428d
5 changed files with 75 additions and 2 deletions

View File

@ -176,7 +176,18 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("Synchronous cmdArchivePush(), archivePushFile() and archivePushProtocol()"))
{
TEST_TITLE("command must be run on the pg host");
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_PG1_HOST "=host");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/pg");
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleDefault, argList);
TEST_ERROR(cmdArchivePush(), HostInvalidError, "archive-push command must be run on the PostgreSQL host");
// -------------------------------------------------------------------------------------------------------------------------
argList = strLstNew();
strLstAddZ(argList, "--stanza=test");
harnessCfgLoad(cfgCmdArchivePush, argList);
@ -412,9 +423,21 @@ testRun(void)
{
harnessLogLevelSet(logLevelDetail);
TEST_TITLE("command must be run on the pg host");
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_PG1_HOST "=host");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/pg");
strLstAddZ(argList, "--" CFGOPT_SPOOL_PATH "=/spool");
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
TEST_ERROR(cmdArchivePush(), HostInvalidError, "archive-push command must be run on the PostgreSQL host");
// Call with a bogus exe name so the async process will error out and we can make sure timeouts work
// -------------------------------------------------------------------------------------------------------------------------
StringList *argList = strLstNew();
argList = strLstNew();
strLstAddZ(argList, "pgbackrest-bogus");
strLstAddZ(argList, "--stanza=test");
strLstAddZ(argList, "--archive-async");