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, 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))) if (defined($oCommand->paramGet('err-expect', false)))
{ {
$$hCacheKey{'err-expect'} = $oCommand->paramGet('err-expect'); $$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"); confess &log(ERROR, "cannot execute on host ${strHostName} because the host does not exist");
} }
my $oExec = $oHost->execute($strCommand, my $oExec = $oHost->execute(
{iExpectedExitStatus => $$hCacheKey{'err-expect'}, $strCommand . (defined($$hCacheKey{'cmd-extra'}) ? ' ' . $$hCacheKey{'cmd-extra'} : ''),
bSuppressError => $oCommand->paramTest('err-suppress', 'y'), {iExpectedExitStatus => $$hCacheKey{'err-expect'},
iRetrySeconds => $oCommand->paramGet('retry', false)}); bSuppressError => $oCommand->paramTest('err-suppress', 'y'),
iRetrySeconds => $oCommand->paramGet('retry', false)});
$oExec->begin(); $oExec->begin();
$oExec->end(); $oExec->end();

View File

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

View File

@ -86,6 +86,12 @@
<release-list> <release-list>
<release date="XXXX-XX-XX" version="1.03dev" title="UNDER DEVELOPMENT"> <release date="XXXX-XX-XX" version="1.03dev" title="UNDER DEVELOPMENT">
<release-doc-list> <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-refactor-list>
<release-item> <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> <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> </execute>
</host-add> </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"> <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"> <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>
</execute-list> </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"> <execute-list host="{[host-db-master]}" keyword="co6">
<title>Install required Perl packages</title> <title>Install required Perl packages</title>
<execute user="root"> <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> perl-Digest-SHA perl-DBD-Pg</exe-cmd>
<exe-cmd-extra>-y</exe-cmd-extra>
</execute> </execute>
</execute-list> </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]}"> <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 --> <!-- Install packages -->
<execute user="root" keyword="default"> <execute user="root" keyword="default">
<exe-cmd>apt-get -y install libdbd-pg-perl libdbi-perl <exe-cmd>apt-get -y install libdbd-pg-perl</exe-cmd>
libnet-daemon-perl libplrpc-perl</exe-cmd>
</execute> </execute>
<execute user="root" keyword="co6"> <execute user="root" keyword="co6">