1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Add cmd-extra field.

Allow hidden options to be added to a command. This allows certain commands (like apt-get) to be forced during the build without making that a part of the documentation.
This commit is contained in:
David Steele 2016-06-03 20:07:28 -04:00
parent 36cf0b18f5
commit e796f563c4
4 changed files with 26 additions and 12 deletions

View File

@ -115,6 +115,11 @@ sub executeKey
output => JSON::PP::false,
};
if (defined($oCommand->fieldGet('exe-cmd-extra', false)))
{
$$hCacheKey{'cmd-extra'} = $oCommand->fieldGet('exe-cmd-extra');
}
if (defined($oCommand->paramGet('err-expect', false)))
{
$$hCacheKey{'err-expect'} = $oCommand->paramGet('err-expect');
@ -211,10 +216,11 @@ sub execute
confess &log(ERROR, "cannot execute on host ${strHostName} because the host does not exist");
}
my $oExec = $oHost->execute($strCommand,
{iExpectedExitStatus => $$hCacheKey{'err-expect'},
bSuppressError => $oCommand->paramTest('err-suppress', 'y'),
iRetrySeconds => $oCommand->paramGet('retry', false)});
my $oExec = $oHost->execute(
$strCommand . (defined($$hCacheKey{'cmd-extra'}) ? ' ' . $$hCacheKey{'cmd-extra'} : ''),
{iExpectedExitStatus => $$hCacheKey{'err-expect'},
bSuppressError => $oCommand->paramTest('err-suppress', 'y'),
iRetrySeconds => $oCommand->paramGet('retry', false)});
$oExec->begin();
$oExec->end();

View File

@ -55,7 +55,7 @@
<!ELEMENT execute-list (title, execute+)>
<!ATTLIST execute-list host CDATA #REQUIRED>
<!ATTLIST execute-list keyword CDATA "">
<!ELEMENT execute (exe-cmd, exe-user?, exe-var?, exe-retry?, exe-output?, (exe-highlight-type?, exe-highlight)?,
<!ELEMENT execute (exe-cmd, exe-cmd-extra?, exe-user?, exe-var?, exe-retry?, exe-output?, (exe-highlight-type?, exe-highlight)?,
exe-err-expect?, exe-err-suppress?, exe-err-suppress-stderr?)>
<!ATTLIST execute keyword CDATA "">
<!ATTLIST execute user CDATA "">
@ -69,6 +69,7 @@
<!ATTLIST execute retry CDATA "">
<!ATTLIST execute variable-key CDATA "">
<!ELEMENT exe-cmd (#PCDATA)>
<!ELEMENT exe-cmd-extra (#PCDATA)>
<!ELEMENT exe-highlight (#PCDATA)>
<!ELEMENT exe-highlight-type (#PCDATA)>

View File

@ -86,6 +86,12 @@
<release-list>
<release date="XXXX-XX-XX" version="1.03dev" title="UNDER DEVELOPMENT">
<release-doc-list>
<release-feature-list>
<release-item>
<p>Allow hidden options to be added to a command. This allows certain commands (like <id>apt-get</id>) to be forced during the build without making that a part of the documentation.</p>
</release-item>
</release-feature-list>
<release-refactor-list>
<release-item>
<p>Recommended install location for <backrest/> modules is now <path>/usr/share/perl5</path> since <path>/usr/lib/perl5</path> has been removed from the search path in newer versions of Perl.</p>

View File

@ -156,24 +156,26 @@
</execute>
</host-add>
<p keyword="default"><backrest/> is written in Perl which is included with {[user-guide-os]} by default. A few additional modules are required which are all available as packages.</p>
<p keyword="default"><backrest/> is written in Perl which is included with {[user-guide-os]} by default. The <id>DBD::Pg</id> module must also be installed.</p>
<execute-list host="{[host-db-master]}" keyword="default">
<title>Install required Perl packages</title>
<title>Install the <id>DBD::Pg</id> module</title>
<execute user="root">
<exe-cmd>apt-get install libdbd-pg-perl libdbi-perl libnet-daemon-perl libplrpc-perl</exe-cmd>
<exe-cmd>apt-get install libdbd-pg-perl</exe-cmd>
<exe-cmd-extra>-y</exe-cmd-extra>
</execute>
</execute-list>
<p keyword="co6"><backrest/> is written in Perl which is not included with {[user-guide-os]} by default, however all required modules are all available as standard packages.</p>
<p keyword="co6"><backrest/> is written in Perl which is not included with {[user-guide-os]} by default, however all required modules are available as standard packages.</p>
<execute-list host="{[host-db-master]}" keyword="co6">
<title>Install required Perl packages</title>
<execute user="root">
<exe-cmd>yum -y install perl perl-Time-HiRes perl-parent perl-JSON
<exe-cmd>yum install perl perl-Time-HiRes perl-parent perl-JSON
perl-Digest-SHA perl-DBD-Pg</exe-cmd>
<exe-cmd-extra>-y</exe-cmd-extra>
</execute>
</execute-list>
@ -1397,8 +1399,7 @@
<host-add name="{[host-db-standby]}" user="{[host-db-standby-user]}" image="{[host-db-standby-image]}" os="{[host-os]}" mount="{[host-db-standby-mount]}">
<!-- Install packages -->
<execute user="root" keyword="default">
<exe-cmd>apt-get -y install libdbd-pg-perl libdbi-perl
libnet-daemon-perl libplrpc-perl</exe-cmd>
<exe-cmd>apt-get -y install libdbd-pg-perl</exe-cmd>
</execute>
<execute user="root" keyword="co6">