1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-18 04:58:51 +02:00

Simplify info command text message when no stanza are present.

Replace the repository path with just "the repository".  The path is not important in this context and it is clearer to state where the stanzas are missing from.
This commit is contained in:
David Steele 2019-01-16 19:23:10 +02:00
parent ef9dc89e08
commit e68d1e7304
8 changed files with 20 additions and 22 deletions

View File

@ -15,6 +15,10 @@
<release date="XXXX-XX-XX" version="2.09dev" title="UNDER DEVELOPMENT">
<release-core-list>
<release-improvement-list>
<release-item>
<p>Simplify <cmd>info</cmd> command text message when no stanza are present by replacing the repository path with <quote>the repository</quote>.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-contributor id="douglas.j.hunley"/>

View File

@ -118,7 +118,7 @@ sub process
}
else
{
syswrite(*STDOUT, 'No stanzas exist in ' . storageRepo()->pathGet() . ".\n");
syswrite(*STDOUT, "No stanzas exist in the repository.\n");
}
}
elsif (cfgOptionTest(CFGOPT_OUTPUT, CFGOPTVAL_INFO_OUTPUT_JSON))

View File

@ -602,7 +602,7 @@ infoRender(void)
}
}
else
resultStr = strNewFmt("No stanzas exist in %s.\n", strPtr(storagePathNP(storageRepo(), NULL)));
resultStr = strNew("No stanzas exist in the repository.\n");
}
// Format json output
else

View File

@ -10424,7 +10424,7 @@ static const EmbeddedModule embeddedModule[] =
"}\n"
"else\n"
"{\n"
"syswrite(*STDOUT, 'No stanzas exist in ' . storageRepo()->pathGet() . \".\\n\");\n"
"syswrite(*STDOUT, \"No stanzas exist in the repository.\\n\");\n"
"}\n"
"}\n"
"elsif (cfgOptionTest(CFGOPT_OUTPUT, CFGOPTVAL_INFO_OUTPUT_JSON))\n"
@ -15159,7 +15159,7 @@ static const EmbeddedModule embeddedModule[] =
"\n\n"
"if ($strRule eq STORAGE_REPO_ARCHIVE)\n"
"{\n"
"$strResultFile = \"archive/${strStanza}\";\n"
"$strResultFile = \"archive\" . (defined($strStanza) ? \"/${strStanza}\" : '');\n"
"\n\n"
"if (defined($strFile))\n"
"{\n"
@ -15179,7 +15179,7 @@ static const EmbeddedModule embeddedModule[] =
"\n"
"elsif ($strRule eq STORAGE_REPO_BACKUP)\n"
"{\n"
"$strResultFile = \"backup/${strStanza}\" . (defined($strFile) ? \"/${strFile}\" : '');\n"
"$strResultFile = \"backup\" . (defined($strStanza) ? \"/${strStanza}\" : '') . (defined($strFile) ? \"/${strFile}\" : '');\n"
"}\n"
"\n"
"else\n"
@ -15221,23 +15221,18 @@ static const EmbeddedModule embeddedModule[] =
"if (isRepoLocal())\n"
"{\n"
"\n"
"my $hRule;\n"
"\n"
"if ($strStanza ne STORAGE_REPO)\n"
"{\n"
"$hRule =\n"
"my $hRule =\n"
"{\n"
"&STORAGE_REPO_ARCHIVE =>\n"
"{\n"
"fnRule => \\&storageRepoRule,\n"
"xData => $strStanza,\n"
"xData => $strStanza eq STORAGE_REPO ? undef : $strStanza,\n"
"},\n"
"&STORAGE_REPO_BACKUP =>\n"
"{\n"
"fnRule => \\&storageRepoRule,\n"
"xData => $strStanza,\n"
"xData => $strStanza eq STORAGE_REPO ? undef : $strStanza,\n"
"},\n"
"}\n"
"};\n"
"\n\n"
"my $oDriver;\n"
@ -18876,7 +18871,7 @@ static const EmbeddedModule embeddedModule[] =
"logDebugParam\n"
"(\n"
"__PACKAGE__ . '->list', \\@_,\n"
"{name => 'strPathExp'},\n"
"{name => 'strPathExp', required => false},\n"
"{name => 'strExpression', optional => true},\n"
"{name => 'strSortOrder', optional => true, default => 'forward'},\n"
"{name => 'bIgnoreMissing', optional => true, default => false},\n"

View File

@ -16,7 +16,7 @@ Displays installed pgBackRest version.
info all stanzas - no stanzas exist (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn info
------------------------------------------------------------------------------------------------------------------------------------
No stanzas exist in [TEST_PATH]/db-master/repo.
No stanzas exist in the repository.
info all stanzas - no stanzas exist (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --output=json info

View File

@ -4,7 +4,7 @@ run 002 - rmt 1, s3 0, enc 0
info all stanzas - no stanzas exist (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn info
------------------------------------------------------------------------------------------------------------------------------------
No stanzas exist in [TEST_PATH]/backup/repo.
No stanzas exist in the repository.
info all stanzas - no stanzas exist (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --output=json info

View File

@ -4,7 +4,7 @@ run 003 - rmt 1, s3 1, enc 1
info all stanzas - no stanzas exist (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn info
------------------------------------------------------------------------------------------------------------------------------------
No stanzas exist in /.
No stanzas exist in the repository.
info all stanzas - no stanzas exist (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --output=json info

View File

@ -37,8 +37,7 @@ testRun(void)
TEST_RESULT_STR(strPtr(infoRender()), "[]\n", "json - repo but no stanzas");
harnessCfgLoad(strLstSize(argListText), strLstPtr(argListText));
TEST_RESULT_STR(strPtr(infoRender()),
strPtr(strNewFmt("No stanzas exist in %s.\n", strPtr(storagePathNP(storageRepo(), NULL)))), "text - no stanzas");
TEST_RESULT_STR(strPtr(infoRender()), "No stanzas exist in the repository.\n", "text - no stanzas");
storagePathCreateNP(storageLocalWrite(), archivePath);
storagePathCreateNP(storageLocalWrite(), backupPath);
@ -836,11 +835,11 @@ testRun(void)
// Restore normal stdout
dup2(stdoutSave, STDOUT_FILENO);
const char *generalHelp = strPtr(strNewFmt("No stanzas exist in %s.\n", strPtr(repoPath)));
Storage *storage = storageDriverPosixInterface(
storageDriverPosixNew(strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL));
TEST_RESULT_STR(strPtr(strNewBuf(storageGetNP(storageNewReadNP(storage, stdoutFile)))), generalHelp, " check text");
TEST_RESULT_STR(
strPtr(strNewBuf(storageGetNP(storageNewReadNP(storage, stdoutFile)))), "No stanzas exist in the repository.\n",
" check text");
}
FUNCTION_HARNESS_RESULT_VOID();