You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-09 00:45:49 +02:00
Improve info command output when a stanza is specified but missing.
Return a path missing error when a stanza is specified for the info command but the stanza does not exist in the repository. Previously [] was returned, which is still the case if no stanza is specified and the repository does not exist.
This commit is contained in:
@ -50,6 +50,17 @@
|
|||||||
</release-feature-list>
|
</release-feature-list>
|
||||||
|
|
||||||
<release-improvement-list>
|
<release-improvement-list>
|
||||||
|
<release-item>
|
||||||
|
<release-item-contributor-list>
|
||||||
|
<release-item-ideator id="uspen"/>
|
||||||
|
<release-item-contributor id="stefan.fercot"/>
|
||||||
|
<release-item-reviewer id="cynthia.shang"/>
|
||||||
|
<release-item-reviewer id="david.steele"/>
|
||||||
|
</release-item-contributor-list>
|
||||||
|
|
||||||
|
<p>Improve <cmd>info</cmd> command output when a stanza is specified but missing.</p>
|
||||||
|
</release-item>
|
||||||
|
|
||||||
<release-item>
|
<release-item>
|
||||||
<release-item-contributor-list>
|
<release-item-contributor-list>
|
||||||
<release-item-reviewer id="cynthia.shang"/>
|
<release-item-reviewer id="cynthia.shang"/>
|
||||||
|
@ -768,7 +768,7 @@ infoRender(void)
|
|||||||
String *resultStr = strNew("");
|
String *resultStr = strNew("");
|
||||||
|
|
||||||
// If the backup storage exists, then search for and process any stanzas
|
// If the backup storage exists, then search for and process any stanzas
|
||||||
if (strLstSize(stanzaList) > 0)
|
if (strLstSize(stanzaList) > 0 || stanza != NULL)
|
||||||
infoList = stanzaInfoList(stanza, stanzaList, backupLabel);
|
infoList = stanzaInfoList(stanza, stanzaList, backupLabel);
|
||||||
|
|
||||||
// Format text output
|
// Format text output
|
||||||
|
@ -42,6 +42,36 @@ testRun(void)
|
|||||||
harnessCfgLoad(cfgCmdInfo, argListText);
|
harnessCfgLoad(cfgCmdInfo, argListText);
|
||||||
TEST_RESULT_STR_Z(infoRender(), "No stanzas exist in the repository.\n", "text - no stanzas");
|
TEST_RESULT_STR_Z(infoRender(), "No stanzas exist in the repository.\n", "text - no stanzas");
|
||||||
|
|
||||||
|
// Repo is still empty but stanza option is specified
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
StringList *argListStanzaOpt = strLstDup(argList);
|
||||||
|
strLstAddZ(argListStanzaOpt, "--stanza=stanza1");
|
||||||
|
harnessCfgLoad(cfgCmdInfo, argListStanzaOpt);
|
||||||
|
TEST_RESULT_STR_Z(
|
||||||
|
infoRender(),
|
||||||
|
"["
|
||||||
|
"{"
|
||||||
|
"\"backup\":[],"
|
||||||
|
"\"db\":[],"
|
||||||
|
"\"name\":\"stanza1\","
|
||||||
|
"\"status\":{"
|
||||||
|
"\"code\":1,"
|
||||||
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
||||||
|
"\"message\":\"missing stanza path\""
|
||||||
|
"}"
|
||||||
|
"}"
|
||||||
|
"]",
|
||||||
|
"json - empty repo, stanza option specified");
|
||||||
|
|
||||||
|
StringList *argListTextStanzaOpt = strLstDup(argListText);
|
||||||
|
strLstAddZ(argListTextStanzaOpt, "--stanza=stanza1");
|
||||||
|
harnessCfgLoad(cfgCmdInfo, argListTextStanzaOpt);
|
||||||
|
TEST_RESULT_STR_Z(
|
||||||
|
infoRender(),
|
||||||
|
"stanza: stanza1\n"
|
||||||
|
" status: error (missing stanza path)\n",
|
||||||
|
"text - empty repo, stanza option specified");
|
||||||
|
|
||||||
storagePathCreateP(storageLocalWrite(), archivePath);
|
storagePathCreateP(storageLocalWrite(), archivePath);
|
||||||
storagePathCreateP(storageLocalWrite(), backupPath);
|
storagePathCreateP(storageLocalWrite(), backupPath);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user