1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Do not pass pg-local/repo-local to a remote process.

This was a hack to prevent the remote from loading host settings, which is now handled by option validity for command roles.

These options are still useful so don't remove them, but do leave them internal for now.
This commit is contained in:
David Steele
2020-12-30 16:03:49 -05:00
parent 141466875f
commit 9bf7dbf6a2
4 changed files with 19 additions and 45 deletions

View File

@@ -1809,6 +1809,12 @@ my %hConfigDefine =
&CFGCMD_STOP => {}, &CFGCMD_STOP => {},
&CFGCMD_VERIFY => {}, &CFGCMD_VERIFY => {},
}, },
&CFGDEF_COMMAND_ROLE =>
{
&CFGCMD_ROLE_DEFAULT => {},
&CFGCMD_ROLE_ASYNC => {},
&CFGCMD_ROLE_LOCAL => {},
},
}, },
&CFGOPT_REPO_HOST => &CFGOPT_REPO_HOST =>
@@ -2987,6 +2993,12 @@ my %hConfigDefine =
&CFGCMD_START => {}, &CFGCMD_START => {},
&CFGCMD_STOP => {}, &CFGCMD_STOP => {},
}, },
&CFGDEF_COMMAND_ROLE =>
{
&CFGCMD_ROLE_DEFAULT => {},
&CFGCMD_ROLE_ASYNC => {},
&CFGCMD_ROLE_LOCAL => {},
},
}, },
&CFGOPT_PG_HOST => &CFGOPT_PG_HOST =>

View File

@@ -2448,18 +2448,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore) PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
), ),
PARSE_RULE_OPTION_COMMAND_ROLE_REMOTE_VALID_LIST
(
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
PARSE_RULE_OPTION_COMMAND(cfgCmdBackup)
PARSE_RULE_OPTION_COMMAND(cfgCmdCheck)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaCreate)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaDelete)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaUpgrade)
),
PARSE_RULE_OPTION_OPTIONAL_LIST PARSE_RULE_OPTION_OPTIONAL_LIST
( (
PARSE_RULE_OPTION_OPTIONAL_DEFAULT("0"), PARSE_RULE_OPTION_OPTIONAL_DEFAULT("0"),
@@ -4314,25 +4302,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
PARSE_RULE_OPTION_COMMAND(cfgCmdVerify) PARSE_RULE_OPTION_COMMAND(cfgCmdVerify)
), ),
PARSE_RULE_OPTION_COMMAND_ROLE_REMOTE_VALID_LIST
(
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
PARSE_RULE_OPTION_COMMAND(cfgCmdBackup)
PARSE_RULE_OPTION_COMMAND(cfgCmdCheck)
PARSE_RULE_OPTION_COMMAND(cfgCmdInfo)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoCreate)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoLs)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoPut)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoRm)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaCreate)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaDelete)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaUpgrade)
PARSE_RULE_OPTION_COMMAND(cfgCmdVerify)
),
PARSE_RULE_OPTION_OPTIONAL_LIST PARSE_RULE_OPTION_OPTIONAL_LIST
( (
PARSE_RULE_OPTION_OPTIONAL_DEFAULT("0"), PARSE_RULE_OPTION_OPTIONAL_DEFAULT("0"),

View File

@@ -393,13 +393,6 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int hostId
} }
} }
// Set local so host settings configured on the remote will not accidentally be picked up
kvPut(
optionReplace,
protocolStorageType == protocolStorageTypeRepo ?
VARSTRZ(cfgOptionIdxName(cfgOptRepoLocal, hostIdx)) : VARSTRZ(cfgParseOptionKeyIdxName(cfgOptPgLocal, 0)),
BOOL_TRUE_VAR);
// Set default to make it explicit which host will be used on the remote // Set default to make it explicit which host will be used on the remote
kvPut( kvPut(
optionReplace, optionReplace,

View File

@@ -270,7 +270,7 @@ testRun(void)
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"), strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"),
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|repo-host-user@repo-host" "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|repo-host-user@repo-host"
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
" --pg1-path=/path/to/pg --process=0 --remote-type=repo --repo=1 --repo1-local --stanza=test1 archive-get:remote", " --pg1-path=/path/to/pg --process=0 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote",
"remote protocol params"); "remote protocol params");
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
@@ -294,7 +294,7 @@ testRun(void)
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|-p|444|repo-host-user@repo-host" "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|-p|444|repo-host-user@repo-host"
"|pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config" "|pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config"
" --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess" " --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess"
" --pg1-path=/unused --process=0 --remote-type=repo --repo=1 --repo1-local --stanza=test1 check:remote", " --pg1-path=/unused --process=0 --remote-type=repo --repo=1 --stanza=test1 check:remote",
"remote protocol params with replacements"); "remote protocol params with replacements");
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
@@ -313,7 +313,7 @@ testRun(void)
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"), strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"),
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|pgbackrest@repo-host" "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|pgbackrest@repo-host"
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
" --pg1-path=/path/to/pg --process=3 --remote-type=repo --repo=1 --repo1-local --stanza=test1 archive-get:remote", " --pg1-path=/path/to/pg --process=3 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote",
"remote protocol params for backup local"); "remote protocol params for backup local");
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
@@ -330,7 +330,7 @@ testRun(void)
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 0), "|"), strLstJoin(protocolRemoteParam(protocolStorageTypePg, 0), "|"),
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg1-host" "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg1-host"
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error --pg=1" "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error --pg=1"
" --pg1-local --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote", " --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote",
"remote protocol params for db backup"); "remote protocol params for db backup");
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
@@ -352,7 +352,7 @@ testRun(void)
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"), strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"),
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg2-host" "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg2-host"
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error --pg=1" "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error --pg=1"
" --pg1-local --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote", " --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote",
"remote protocol params for db local"); "remote protocol params for db local");
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
@@ -374,8 +374,8 @@ testRun(void)
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"), strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"),
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg3-host" "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg3-host"
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error --pg=1" "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error --pg=1"
" --pg1-local --pg1-path=/path/to/3 --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg" " --pg1-path=/path/to/3 --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg --stanza=test1"
" --stanza=test1 backup:remote", " backup:remote",
"remote protocol params for db local"); "remote protocol params for db local");
} }