1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Document generator improvements.

* Allow parameters to be passed when a container is created.
* Allow /etc/hosts update to be skipped (for containers without bash).
This commit is contained in:
David Steele
2018-05-25 13:42:09 -04:00
parent 40093f160c
commit e57840d739
5 changed files with 33 additions and 6 deletions
@@ -59,18 +59,23 @@ sub hostAdd
$strOperation,
$oHost,
$rstryHostName,
$bUpdateHosts,
) =
logDebugParam
(
__PACKAGE__ . '->hostAdd', \@_,
{name => 'oHost'},
{name => 'rstryHostName', optional => true},
{name => 'bUpdateHosts', default => true, optional => true},
);
$self->{host}{$oHost->{strName}} = $oHost;
$oHost->executeSimple("echo \"\" >> /etc/hosts", undef, 'root');
$oHost->executeSimple("echo \"# Test Hosts\" >> /etc/hosts", undef, 'root');
if ($bUpdateHosts)
{
$oHost->executeSimple("echo \"\" >> /etc/hosts", undef, 'root');
$oHost->executeSimple("echo \"# Test Hosts\" >> /etc/hosts", undef, 'root');
}
my $strHostList = $oHost->{strName} . (defined($rstryHostName) ? ' ' . join(' ', @{$rstryHostName}) : '');
@@ -85,7 +90,10 @@ sub hostAdd
$oOtherHost->executeSimple("echo \"$oHost->{strIP} ${strHostList}\" >> /etc/hosts", undef, 'root');
# Add all other host IPs to this host
$oHost->executeSimple("echo \"$oOtherHost->{strIP} ${strOtherHostName}\" >> /etc/hosts", undef, 'root');
if ($bUpdateHosts)
{
$oHost->executeSimple("echo \"$oOtherHost->{strIP} ${strOtherHostName}\" >> /etc/hosts", undef, 'root');
}
}
}
+3 -1
View File
@@ -40,6 +40,7 @@ sub new
$self->{strOS},
$self->{stryMount},
$self->{strOption},
$self->{strParam},
) =
logDebugParam
(
@@ -51,6 +52,7 @@ sub new
{name => 'strOS', trace => true},
{name => 'stryMount', required => false, trace => true},
{name => 'strOption', required => false, trace => true},
{name => 'strParam', required => false, trace => true},
);
executeTest("docker rm -f $self->{strContainer}", {bSuppressError => true});
@@ -58,7 +60,7 @@ sub new
executeTest("docker run -itd -h $self->{strName} --name=$self->{strContainer}" .
(defined($self->{strOption}) ? ' ' . $self->{strOption} : '') .
(defined($self->{stryMount}) ? ' -v ' . join(' -v ', @{$self->{stryMount}}) : '') .
" $self->{strImage}",
" $self->{strImage} " . (defined($self->{strParam}) ? ' ' . $self->{strParam} : ''),
{bSuppressStdErr => true});
# Get IP Address