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

Don't pass local config* options to the remote.

The remotes have their own config options (repo-host-config, etc.) so don't pass the local config* options.

This was a regression from the behavior of the Perl code and while there have been no field reports it caused breakage on test systems with multiple configurations.
This commit is contained in:
David Steele
2019-07-26 08:37:58 -04:00
parent f8b0676fd6
commit 88c1929ec5
2 changed files with 13 additions and 6 deletions

View File

@@ -235,18 +235,19 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int protoc
// Replace config options with the host versions
unsigned int optConfig = isRepo ? cfgOptRepoHostConfig : cfgOptPgHostConfig + hostIdx;
if (cfgOptionSource(optConfig) != cfgSourceDefault)
kvPut(optionReplace, VARSTR(CFGOPT_CONFIG_STR), cfgOption(optConfig));
kvPut(optionReplace, VARSTR(CFGOPT_CONFIG_STR), cfgOptionSource(optConfig) != cfgSourceDefault ? cfgOption(optConfig) : NULL);
unsigned int optConfigIncludePath = isRepo ? cfgOptRepoHostConfigIncludePath : cfgOptPgHostConfigIncludePath + hostIdx;
if (cfgOptionSource(optConfigIncludePath) != cfgSourceDefault)
kvPut(optionReplace, VARSTR(CFGOPT_CONFIG_INCLUDE_PATH_STR), cfgOption(optConfigIncludePath));
kvPut(
optionReplace, VARSTR(CFGOPT_CONFIG_INCLUDE_PATH_STR),
cfgOptionSource(optConfigIncludePath) != cfgSourceDefault ? cfgOption(optConfigIncludePath) : NULL);
unsigned int optConfigPath = isRepo ? cfgOptRepoHostConfigPath : cfgOptPgHostConfigPath + hostIdx;
if (cfgOptionSource(optConfigPath) != cfgSourceDefault)
kvPut(optionReplace, VARSTR(CFGOPT_CONFIG_PATH_STR), cfgOption(optConfigPath));
kvPut(
optionReplace, VARSTR(CFGOPT_CONFIG_PATH_STR),
cfgOptionSource(optConfigPath) != cfgSourceDefault ? cfgOption(optConfigPath) : NULL);
// Use a C remote
kvPut(optionReplace, VARSTR(CFGOPT_C_STR), VARBOOL(true));

View File

@@ -150,11 +150,17 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("protocolRemoteParam()"))
{
storagePutNP(storageNewWriteNP(storageTest, strNew("pgbackrest.conf")), bufNew(0));
StringList *argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--repo1-host=repo-host");
strLstAddZ(argList, "--repo1-host-user=repo-host-user");
// Local config settings should never be passed to the remote
strLstAdd(argList, strNewFmt("--config=%s/pgbackrest.conf", testPath()));
strLstAdd(argList, strNewFmt("--config-include-path=%s", testPath()));
strLstAdd(argList, strNewFmt("--config-path=%s", testPath()));
strLstAddZ(argList, "archive-get");
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));