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

Remove dependency on aws cli for testing.

This tool was only being used it a few places but was a pretty large dependency.

Rework the forceStorageMove() code using our storage layer and replace one aws cli cp with a storage put.

Also, remove the Dockerfile that was once used to build the Scality S3 test container.
This commit is contained in:
David Steele
2019-10-09 14:38:24 -04:00
parent ac870b42de
commit 528f4c4347
6 changed files with 31 additions and 116 deletions
+29 -3
View File
@@ -32,6 +32,7 @@ use pgBackRest::Storage::Base;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
use pgBackRestTest::Common::LogTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Host::HostBackupTest;
@@ -204,9 +205,34 @@ sub forceStorageMove
# If S3 then use storage commands to remove
if ($oStorage->type() eq STORAGE_S3)
{
hostGroupGet()->hostGet(HOST_S3)->executeS3(
'mv' . ($bRecurse ? ' --recursive' : '') . ' s3://' . HOST_S3_BUCKET . $oStorage->pathGet($strSourcePathExp) .
' s3://' . HOST_S3_BUCKET . $oStorage->pathGet($strDestinationPathExp));
if ($bRecurse)
{
my $rhManifest = $oStorage->manifest($strSourcePathExp);
foreach my $strName (sort(keys(%{$rhManifest})))
{
if ($rhManifest->{$strName}{type} eq 'f')
{
$oStorage->put(
new pgBackRest::Storage::StorageWrite(
$oStorage,
pgBackRest::LibC::StorageWrite->new(
$oStorage->{oStorageC}, "${strDestinationPathExp}/${strName}", 0, undef, undef, 0, true, false)),
${$oStorage->get(
new pgBackRest::Storage::StorageRead(
$oStorage,
pgBackRest::LibC::StorageRead->new(
$oStorage->{oStorageC}, "${strSourcePathExp}/${strName}", false)))});
$oStorage->remove("${strSourcePathExp}/${strName}");
}
}
}
else
{
$oStorage->put($strDestinationPathExp, ${$oStorage->get($strSourcePathExp)});
$oStorage->remove($strSourcePathExp);
}
}
# Else remove using filesystem commands
else
@@ -85,48 +85,4 @@ sub new
);
}
####################################################################################################################################
# executeS3
####################################################################################################################################
sub executeS3
{
my $self = shift;
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strCommand
) =
logDebugParam
(
__PACKAGE__ . '->executeS3', \@_,
{name => 'strCommand', trace => true},
);
# Retry the command until timeout
my $oWait = waitInit(60);
my $bSuccess = false;
my $strTotalCommand =
'export PYTHONWARNINGS="ignore" && aws --endpoint-url=https://' . $self->ipGet() . ' s3 --no-verify-ssl ' . $strCommand;
do
{
my $oExec = new pgBackRestTest::Common::ExecuteTest($strTotalCommand, {bSuppressError => true, bSuppressStdErr => true});
$oExec->begin();
$bSuccess = $oExec->end() == 0;
}
while (!$bSuccess && waitMore($oWait));
# If no success run again to display the error
if (!$bSuccess)
{
executeTest($strTotalCommand);
}
# Return from function and log return values if any
return logDebugReturn($strOperation);
}
1;
@@ -540,7 +540,7 @@ sub run
if ($bS3)
{
$oHostS3->executeS3('cp /etc/hosts s3://' . HOST_S3_BUCKET . "${strTempFile}");
storageRepo()->put($strTempFile, "TEMP");
}
else
{