mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
Allow "global" as a stanza prefix.
A stanza name like global_stanza was not allowed because the code was not selective enough about how a global section should be formatted. Update the config parser to correctly recognize global sections.
This commit is contained in:
parent
338102861f
commit
498902e885
@ -16,6 +16,21 @@
|
||||
<release-list>
|
||||
<release date="XXXX-XX-XX" version="2.36dev" title="UNDER DEVELOPMENT">
|
||||
<release-core-list>
|
||||
<release-bug-list>
|
||||
<release-item>
|
||||
<github-issue id="1524"/>
|
||||
<github-pull-request id="1525"/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="younes.alhroub"/>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
<release-item-reviewer id="stefan.fercot"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Allow <quote>global</quote> as a stanza prefix.</p>
|
||||
</release-item>
|
||||
</release-bug-list>
|
||||
|
||||
<release-improvement-list>
|
||||
<release-item>
|
||||
<commit subject="Refactor restoreManifestMap() tests in the command/restore unit."/>
|
||||
@ -10789,6 +10804,11 @@
|
||||
<contributor-id type="github">sharmay</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="younes.alhroub">
|
||||
<contributor-name-display>Younes Alhroub</contributor-name-display>
|
||||
<contributor-id type="github">alhroub</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="yummyliu">
|
||||
<contributor-name-display>yummyliu</contributor-name-display>
|
||||
<contributor-id type="github">yummyliu</contributor-id>
|
||||
|
@ -1599,7 +1599,7 @@ configParse(const Storage *storage, unsigned int argListSize, const char *argLis
|
||||
|
||||
// Continue if stanza option is in a global section
|
||||
if (parseRuleOption[option.id].section == cfgSectionStanza &&
|
||||
strBeginsWithZ(section, CFGDEF_SECTION_GLOBAL))
|
||||
(strEqZ(section, CFGDEF_SECTION_GLOBAL) || strBeginsWithZ(section, CFGDEF_SECTION_GLOBAL ":")))
|
||||
{
|
||||
LOG_WARN_FMT(
|
||||
"configuration file contains stanza-only option '%s' in global section '%s'", strZ(key),
|
||||
|
@ -1469,6 +1469,25 @@ testRun(void)
|
||||
"\nHINT: port is not a positive integer.");
|
||||
TEST_RESULT_UINT(port, 777, "check that port was not updated");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("global is a valid stanza prefix");
|
||||
|
||||
storagePutP(
|
||||
storageNewWriteP(storageTestWrite, configFile),
|
||||
BUFSTRDEF(
|
||||
"[global_stanza]\n"
|
||||
"pg1-path=/path/to/global/stanza\n"));
|
||||
|
||||
argList = strLstNew();
|
||||
strLstAddZ(argList, TEST_BACKREST_EXE);
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "global_stanza");
|
||||
hrnCfgArgRaw(argList, cfgOptConfig, configFile);
|
||||
strLstAddZ(argList, TEST_COMMAND_BACKUP);
|
||||
|
||||
TEST_RESULT_VOID(configParse(storageTest, strLstSize(argList), strLstPtr(argList), false), "parse config");
|
||||
|
||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptPgPath), "/path/to/global/stanza", "default pg-path");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("warnings for environment variables, command-line and config file options");
|
||||
|
||||
@ -1503,6 +1522,7 @@ testRun(void)
|
||||
"compress-level=3\n"
|
||||
"spool-path=/path/to/spool\n"
|
||||
"lock-path=/\n"
|
||||
"pg1-path=/not/path/to/db\n"
|
||||
"\n"
|
||||
"[global:backup]\n"
|
||||
"repo1-hardlink=y\n"
|
||||
@ -1546,7 +1566,8 @@ testRun(void)
|
||||
"P00 WARN: configuration file contains reset option 'reset-delta'\n"
|
||||
"P00 WARN: configuration file contains command-line only option 'online'\n"
|
||||
"P00 WARN: configuration file contains stanza-only option 'pg1-path' in global section 'global:backup'\n"
|
||||
"P00 WARN: configuration file contains invalid option 'backup-standb'");
|
||||
"P00 WARN: configuration file contains invalid option 'backup-standb'\n"
|
||||
"P00 WARN: configuration file contains stanza-only option 'pg1-path' in global section 'global'");
|
||||
|
||||
TEST_RESULT_STR_Z(jsonFromVar(varNewVarLst(cfgCommandJobRetry())), "[0,33000,33000]", "custom job retries");
|
||||
TEST_RESULT_BOOL(cfgOptionIdxTest(cfgOptPgHost, 0), false, "pg1-host is not set (command line reset override)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user