mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-06-20 01:17:49 +02:00
Fix possibly missing pg1-* options for the remote command.
Some pg1-* options are required by the remote so if they are not provided in the remote's configuration file then it may cause a configuration error, depending on the operation. This currently only applies to the pg1-path option. This is still an issue for repo-* options but the same solution cannot be applied because some repo-* options are secure and cannot be passed on the command-line.
This commit is contained in:
@@ -278,6 +278,7 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int protoc
|
||||
cfgOptionSource(optConfigPath) != cfgSourceDefault ? cfgOption(optConfigPath) : NULL);
|
||||
|
||||
// Update/remove repo/pg options that are sent to the remote
|
||||
ConfigDefineCommand commandDefId = cfgCommandDefIdFromId(cfgCommand());
|
||||
const String *repoHostPrefix = STR(cfgDefOptionName(cfgDefOptRepoHost));
|
||||
const String *repoPrefix = strNewFmt("%s-", PROTOCOL_REMOTE_TYPE_REPO);
|
||||
const String *pgHostPrefix = STR(cfgDefOptionName(cfgDefOptPgHost));
|
||||
@@ -285,7 +286,8 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int protoc
|
||||
|
||||
for (ConfigOption optionId = 0; optionId < CFG_OPTION_TOTAL; optionId++)
|
||||
{
|
||||
const String *optionDefName = STR(cfgDefOptionName(cfgOptionDefIdFromId(optionId)));
|
||||
ConfigDefineOption optionDefId = cfgOptionDefIdFromId(optionId);
|
||||
const String *optionDefName = STR(cfgDefOptionName(optionDefId));
|
||||
bool remove = false;
|
||||
|
||||
// Remove repo host options that are not needed on the remote. The remote is not expecting to see host settings and it
|
||||
@@ -308,10 +310,10 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int protoc
|
||||
}
|
||||
else if (strBeginsWith(optionDefName, pgPrefix))
|
||||
{
|
||||
// Remove pg options when the remote type is repo since they won't be used
|
||||
// Remove unrequired/defaulted pg options when the remote type is repo since they won't be used
|
||||
if (protocolStorageType == protocolStorageTypeRepo)
|
||||
{
|
||||
remove = true;
|
||||
remove = !cfgDefOptionRequired(commandDefId, optionDefId) || cfgDefOptionDefault(commandDefId, optionDefId) != NULL;
|
||||
}
|
||||
// Else move/remove pg options with index > 0 since they won't be used
|
||||
else if (cfgOptionIndex(optionId) > 0)
|
||||
|
||||
Reference in New Issue
Block a user