1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Container executions now load the user's environment.

This commit is contained in:
David Steele
2017-02-16 17:18:48 -05:00
parent 2d7d9626bb
commit ac7ff755b3
5 changed files with 21 additions and 7 deletions

View File

@@ -971,16 +971,16 @@ sub sectionChildProcess
$self->{oManifest}->variableSet("host-$$hCacheKey{name}-ip", $oHost->{strIP}, true);
$$hCacheValue{ip} = $oHost->{strIP};
# Execute cleanup commands
# Add to the host group
my $oHostGroup = hostGroupGet();
$oHostGroup->hostAdd($oHost);
# Execute initialize commands
foreach my $oExecute ($oChild->nodeList('execute', false))
{
$self->execute($oSection, $$hCacheKey{name}, $oExecute, $iDepth + 1, false);
}
# Add to the host group
my $oHostGroup = hostGroupGet();
$oHostGroup->hostAdd($oHost);
$self->cachePush($strCacheType, $hCacheKey, $hCacheValue);
}
}

View File

@@ -153,6 +153,16 @@
</contributor-list>
<release-list>
<release date="XXXX-XX-XX" version="1.16dev" title="UNDER DEVELOPMENT">
<release-doc-list>
<release-refactor-list>
<release-item>
<p>Container executions now load the user's environment.</p>
</release-item>
</release-refactor-list>
</release-doc-list>
</release>
<release date="2017-02-13" version="1.15" title="Refactoring and Bug Fixes">
<release-core-list>
<release-bug-list>

View File

@@ -361,6 +361,10 @@ sub containerBuild
$strScript .=
"RUN apt-get update\n" .
"RUN apt-get -y install openssh-server wget\n";
$strScript .=
"\n# Fix root tty\n" .
"RUN sed -i 's/^mesg n/tty -s \\&\\& mesg n/g' /root/.profile\n";
}
# Add PostgreSQL packages

View File

@@ -125,7 +125,7 @@ sub execute
$strCommand =~ s/'/'\\''/g;
my $oExec = new pgBackRestTest::Common::ExecuteTest(
"docker exec -u ${strUser} $self->{strContainer} sh -c '${strCommand}'" , $oParam);
"docker exec -u ${strUser} $self->{strContainer} bash -l -c '${strCommand}'" , $oParam);
# Return from function and log return values if any
return logDebugReturn

View File

@@ -327,7 +327,7 @@ sub regExpReplaceAll
# Replace the exe path/file with sh ' prepended
my $strLineBefore = $strLine;
$strLine =~ s/sh -c '$self->{strCommandMain}/[BACKREST-BIN]/g;
$strLine =~ s/bash -l -c '$self->{strCommandMain}/[BACKREST-BIN]/g;
# Replace the final ' if the previous expression made changes
if ($strLine ne $strLineBefore)