You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-05-22 10:15:16 +02:00
Remove pgbackrest test user.
This user was created before we tested in containers to ensure isolation between the pg and repo hosts which were then just directories. The downside is that this resulted in a lot of sudos to set the pgbackrest user and to remove files which did not belong to the main test user. Containers provide isolation without needing separate users so we can now safely remove the pgbackrest user. This allows us to remove most sudos, except where they are explicitly needed in tests. While we're at it, remove the code that installed the Perl C library (which also required sudo) and simply add the build path to @INC instead.
This commit is contained in:
@@ -273,7 +273,6 @@ sub buildMakefile
|
||||
('#' x 132) . "\n" .
|
||||
buildMakefileObjectCompile($oStorage, {rhOption => $rhOption});
|
||||
|
||||
|
||||
# Return from function and log return values if any
|
||||
return logDebugReturn
|
||||
(
|
||||
|
||||
@@ -28,12 +28,6 @@ use pgBackRestTest::Common::VmTest;
|
||||
####################################################################################################################################
|
||||
# User/group definitions
|
||||
####################################################################################################################################
|
||||
use constant POSTGRES_GROUP => 'postgres';
|
||||
push @EXPORT, qw(POSTGRES_GROUP);
|
||||
use constant POSTGRES_GROUP_ID => 5000;
|
||||
use constant POSTGRES_USER => POSTGRES_GROUP;
|
||||
use constant POSTGRES_USER_ID => 5000;
|
||||
|
||||
use constant TEST_USER => getpwuid($UID) . '';
|
||||
push @EXPORT, qw(TEST_USER);
|
||||
use constant TEST_USER_ID => $UID;
|
||||
@@ -41,18 +35,6 @@ use constant TEST_GROUP => getgrgid(
|
||||
push @EXPORT, qw(TEST_GROUP);
|
||||
use constant TEST_GROUP_ID => getgrnam(TEST_GROUP) . '';
|
||||
|
||||
use constant BACKREST_USER => 'pgbackrest';
|
||||
push @EXPORT, qw(BACKREST_USER);
|
||||
use constant BACKREST_USER_ID => getpwnam(BACKREST_USER) ? getpwnam(BACKREST_USER) . '' : undef;
|
||||
|
||||
####################################################################################################################################
|
||||
# Package constants
|
||||
####################################################################################################################################
|
||||
use constant LIB_COVER_VERSION => '1.29-2';
|
||||
push @EXPORT, qw(LIB_COVER_VERSION);
|
||||
use constant LIB_COVER_EXE => '/usr/bin/cover';
|
||||
push @EXPORT, qw(LIB_COVER_EXE);
|
||||
|
||||
####################################################################################################################################
|
||||
# Cert file constants
|
||||
####################################################################################################################################
|
||||
@@ -74,18 +56,6 @@ use constant CONTAINER_DEBUG => false;
|
||||
####################################################################################################################################
|
||||
my $hContainerCache;
|
||||
|
||||
####################################################################################################################################
|
||||
# Generate Devel::Cover package name
|
||||
####################################################################################################################################
|
||||
sub packageDevelCover
|
||||
{
|
||||
my $strArch = shift;
|
||||
|
||||
return 'libdevel-cover-perl_' . LIB_COVER_VERSION . "_${strArch}.deb";
|
||||
}
|
||||
|
||||
push @EXPORT, qw(packageDevelCover);
|
||||
|
||||
####################################################################################################################################
|
||||
# Container repo - defines the Docker repository where the containers will be located
|
||||
####################################################################################################################################
|
||||
@@ -463,11 +433,6 @@ sub containerBuild
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if (!$bDeprecated)
|
||||
{
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create PostgreSQL user/group with known ids for testing\n" .
|
||||
' ' . groupCreate($strOS, POSTGRES_GROUP, POSTGRES_GROUP_ID) . " && \\\n" .
|
||||
' ' . userCreate($strOS, POSTGRES_USER, POSTGRES_USER_ID, POSTGRES_GROUP);
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install PostgreSQL packages\n";
|
||||
|
||||
@@ -567,8 +532,6 @@ sub containerBuild
|
||||
$strImage = "${strOS}-build";
|
||||
$strCopy = undef;
|
||||
|
||||
my $strPkgDevelCover = packageDevelCover($oVm->{$strOS}{&VM_ARCH});
|
||||
|
||||
$strScript = sectionHeader() .
|
||||
"# Create test user\n" .
|
||||
' ' . groupCreate($strOS, TEST_GROUP, TEST_GROUP_ID) . " && \\\n" .
|
||||
@@ -643,13 +606,6 @@ sub containerBuild
|
||||
$strScript .=
|
||||
sshSetup($strOS, TEST_USER, TEST_GROUP, $$oVm{$strOS}{&VM_CONTROL_MASTER});
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create pgbackrest user\n" .
|
||||
' ' . userCreate($strOS, BACKREST_USER, BACKREST_USER_ID, TEST_GROUP);
|
||||
|
||||
$strScript .=
|
||||
sshSetup($strOS, BACKREST_USER, TEST_GROUP, $$oVm{$strOS}{&VM_CONTROL_MASTER});
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Make " . TEST_USER . " home dir readable\n" .
|
||||
' chmod g+r,g+x /home/' . TEST_USER;
|
||||
|
||||
@@ -84,7 +84,7 @@ sub testPathRemove
|
||||
my $strPath = shift;
|
||||
my $bSuppressError = shift;
|
||||
|
||||
executeTest('sudo rm -rf ' . $strPath, {bSuppressError => $bSuppressError});
|
||||
executeTest('rm -rf ' . $strPath, {bSuppressError => $bSuppressError});
|
||||
}
|
||||
|
||||
push(@EXPORT, qw(testPathRemove));
|
||||
@@ -170,7 +170,7 @@ sub forceStorageMode
|
||||
# Mode commands are ignored on S3
|
||||
if ($oStorage->type() ne STORAGE_S3)
|
||||
{
|
||||
executeTest('sudo chmod ' . ($bRecurse ? '-R ' : '') . "${strMode} " . $oStorage->pathGet($strPathExp));
|
||||
executeTest('chmod ' . ($bRecurse ? '-R ' : '') . "${strMode} " . $oStorage->pathGet($strPathExp));
|
||||
}
|
||||
|
||||
# Return from function and log return values if any
|
||||
@@ -237,7 +237,7 @@ sub forceStorageMove
|
||||
# Else remove using filesystem commands
|
||||
else
|
||||
{
|
||||
executeTest('sudo mv ' . $oStorage->pathGet($strSourcePathExp) . ' ' . $oStorage->pathGet($strDestinationPathExp));
|
||||
executeTest('mv ' . $oStorage->pathGet($strSourcePathExp) . ' ' . $oStorage->pathGet($strDestinationPathExp));
|
||||
}
|
||||
|
||||
# Return from function and log return values if any
|
||||
@@ -272,7 +272,7 @@ sub forceStorageOwner
|
||||
# Owner commands are ignored on S3
|
||||
if ($oStorage->type() ne STORAGE_S3)
|
||||
{
|
||||
executeTest('sudo chown ' . ($bRecurse ? '-R ' : '') . "${strOwner} " . $oStorage->pathGet($strPathExp));
|
||||
executeTest('chown ' . ($bRecurse ? '-R ' : '') . "${strOwner} " . $oStorage->pathGet($strPathExp));
|
||||
}
|
||||
|
||||
# Return from function and log return values if any
|
||||
@@ -318,7 +318,7 @@ sub forceStorageRemove
|
||||
}
|
||||
else
|
||||
{
|
||||
executeTest('sudo rm -f' . ($bRecurse ? 'r ' : ' ') . $oStorage->pathGet($strPathExp));
|
||||
executeTest('rm -f' . ($bRecurse ? 'r ' : ' ') . $oStorage->pathGet($strPathExp));
|
||||
}
|
||||
|
||||
# Return from function and log return values if any
|
||||
|
||||
@@ -57,6 +57,7 @@ sub new
|
||||
$self->{strTestPath},
|
||||
$self->{oTest},
|
||||
$self->{bDryRun},
|
||||
$self->{strVmHost},
|
||||
$self->{bVmOut},
|
||||
$self->{iVmIdx},
|
||||
$self->{iVmMax},
|
||||
@@ -87,6 +88,7 @@ sub new
|
||||
{name => 'strTestPath'},
|
||||
{name => 'oTest'},
|
||||
{name => 'bDryRun'},
|
||||
{name => 'strVmHost'},
|
||||
{name => 'bVmOut'},
|
||||
{name => 'iVmIdx'},
|
||||
{name => 'iVmMax'},
|
||||
@@ -232,9 +234,7 @@ sub run
|
||||
# If testing Perl code (or C code that calls Perl code) install bin and Perl C Library
|
||||
if ($self->{oTest}->{&TEST_VM} ne VM_NONE && (!$self->{oTest}->{&TEST_C} || $self->{oTest}->{&TEST_PERL_REQ}))
|
||||
{
|
||||
jobInstallC(
|
||||
$self->{strBackRestBase}, $self->{oTest}->{&TEST_VM}, $strImage,
|
||||
!$self->{oTest}->{&TEST_C} && !$self->{oTest}->{&TEST_INTEGRATION});
|
||||
jobInstallC($self->{strBackRestBase}, $self->{oTest}->{&TEST_VM}, $strImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,6 +269,7 @@ sub run
|
||||
($self->{oTest}->{&TEST_CONTAINER} ? 'docker exec -i -u ' . TEST_USER . " ${strImage} " : '') .
|
||||
abs_path($0) .
|
||||
" --test-path=${strVmTestPath}" .
|
||||
" --vm-host=$self->{strVmHost}" .
|
||||
" --vm=$self->{oTest}->{&TEST_VM}" .
|
||||
" --vm-id=$self->{iVmIdx}" .
|
||||
" --module=" . $self->{oTest}->{&TEST_MODULE} .
|
||||
@@ -753,7 +754,7 @@ sub end
|
||||
containerRemove("test-$self->{iVmIdx}");
|
||||
}
|
||||
|
||||
executeTest(($self->{oTest}->{&TEST_VM} ne VM_NONE ? "sudo " : '') . "rm -rf ${strHostTestPath}");
|
||||
executeTest("rm -rf ${strHostTestPath}");
|
||||
}
|
||||
|
||||
$bDone = true;
|
||||
@@ -776,20 +777,15 @@ sub jobInstallC
|
||||
my $strBasePath = shift;
|
||||
my $strVm = shift;
|
||||
my $strImage = shift;
|
||||
my $bCopyLibC = shift;
|
||||
|
||||
# Install Perl C Library
|
||||
my $oVm = vmGet();
|
||||
my $strBuildPath = "${strBasePath}/test/.vagrant/bin/${strVm}";
|
||||
my $strBuildLibCPath = "${strBuildPath}/libc";
|
||||
my $strBuildBinPath = "${strBuildPath}/src";
|
||||
my $strPerlAutoPath = $oVm->{$strVm}{&VMDEF_PERL_ARCH_PATH} . '/auto/pgBackRest/LibC';
|
||||
|
||||
executeTest(
|
||||
"docker exec -i -u root ${strImage} bash -c '" .
|
||||
(defined($bCopyLibC) && $bCopyLibC ?
|
||||
"mkdir -p -m 755 ${strPerlAutoPath} && " .
|
||||
"cp ${strBuildLibCPath}/blib/arch/auto/pgBackRest/LibC/LibC.so ${strPerlAutoPath} && " : '') .
|
||||
"cp ${strBuildBinPath}/" . PROJECT_EXE . ' /usr/bin/' . PROJECT_EXE . ' && ' .
|
||||
'chmod 755 /usr/bin/' . PROJECT_EXE . "'");
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ use constant TEST_MODULE => 'module';
|
||||
push @EXPORT, qw(TEST_MODULE);
|
||||
use constant TEST_NAME => 'test';
|
||||
push @EXPORT, qw(TEST_NAME);
|
||||
use constant TEST_PERL_ARCH_PATH => VMDEF_PERL_ARCH_PATH;
|
||||
push @EXPORT, qw(TEST_PERL_ARCH_PATH);
|
||||
use constant TEST_PERL_REQ => 'perl-req';
|
||||
push @EXPORT, qw(TEST_PERL_REQ);
|
||||
use constant TEST_PGSQL_BIN => 'pgsql-bin';
|
||||
@@ -174,7 +172,6 @@ sub testListGet
|
||||
&TEST_CONTAINER => defined($hTest->{&TESTDEF_CONTAINER}) ?
|
||||
$hTest->{&TESTDEF_CONTAINER} : $hModule->{&TESTDEF_CONTAINER},
|
||||
&TEST_PGSQL_BIN => $strPgSqlBin,
|
||||
&TEST_PERL_ARCH_PATH => $$oyVm{$strTestOS}{&VMDEF_PERL_ARCH_PATH},
|
||||
&TEST_PERL_REQ => $hTest->{&TESTDEF_PERL_REQ},
|
||||
&TEST_INTEGRATION => $hTest->{&TESTDEF_INTEGRATION},
|
||||
&TEST_MODULE => $strModule,
|
||||
|
||||
@@ -90,7 +90,7 @@ sub cleanTest
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
executeTest('sudo rm -rf ' . $self->testPath() . '/*');
|
||||
executeTest('rm -rf ' . $self->testPath() . '/*');
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
@@ -126,7 +126,6 @@ sub process
|
||||
$self->{bCleanup},
|
||||
$self->{bLogForce},
|
||||
$self->{strPgUser},
|
||||
$self->{strBackRestUser},
|
||||
$self->{strGroup},
|
||||
) =
|
||||
logDebugParam
|
||||
@@ -148,7 +147,6 @@ sub process
|
||||
{name => 'bCleanup'},
|
||||
{name => 'bLogForce'},
|
||||
{name => 'strPgUser'},
|
||||
{name => 'strBackRestUser'},
|
||||
{name => 'strGroup'},
|
||||
);
|
||||
|
||||
@@ -544,7 +542,6 @@ push(@EXPORT, qw(storageTest));
|
||||
####################################################################################################################################
|
||||
sub archBits {return vmArchBits(shift->{strVm})}
|
||||
sub backrestExe {return shift->{strBackRestExe}}
|
||||
sub backrestUser {return shift->{strBackRestUser}}
|
||||
sub basePath {return shift->{strBasePath}}
|
||||
sub dataPath {return shift->basePath() . '/test/data'}
|
||||
sub doCleanup {return shift->{bCleanup}}
|
||||
|
||||
@@ -43,8 +43,6 @@ use constant VM_OS_REPO => 'os-repo'
|
||||
push @EXPORT, qw(VM_OS_REPO);
|
||||
use constant VMDEF_PGSQL_BIN => 'pgsql-bin';
|
||||
push @EXPORT, qw(VMDEF_PGSQL_BIN);
|
||||
use constant VMDEF_PERL_ARCH_PATH => 'perl-arch-path';
|
||||
push @EXPORT, qw(VMDEF_PERL_ARCH_PATH);
|
||||
use constant VMDEF_WITH_BACKTRACE => 'with-backtrace';
|
||||
push @EXPORT, qw(VMDEF_WITH_BACKTRACE);
|
||||
|
||||
@@ -129,12 +127,11 @@ my $oyVm =
|
||||
# None
|
||||
&VM_NONE =>
|
||||
{
|
||||
&VM_OS_BASE => VM_OS_BASE_RHEL,
|
||||
&VM_OS => VM_OS_CENTOS,
|
||||
&VM_OS_BASE => VM_OS_BASE_DEBIAN,
|
||||
&VM_OS => VM_OS_UBUNTU,
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_COVERAGE_C => true,
|
||||
&VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5',
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
@@ -155,7 +152,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'centos:6',
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
@@ -185,7 +181,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'centos:7',
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5',
|
||||
|
||||
&VMDEF_DEBUG_INTEGRATION => false,
|
||||
|
||||
@@ -212,7 +207,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'fedora:30',
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5',
|
||||
|
||||
&VMDEF_DEBUG_INTEGRATION => false,
|
||||
|
||||
@@ -241,7 +235,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'debian:8',
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.20.2',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
@@ -272,7 +265,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'debian:9',
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/i386-linux-gnu/perl/5.24.1',
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
@@ -300,7 +292,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'i386/ubuntu:12.04',
|
||||
&VM_ARCH => VM_ARCH_I386,
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/perl/5.14.2',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
@@ -330,7 +321,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'ubuntu:14.04',
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/perl/5.18.2',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
@@ -361,7 +351,6 @@ my $oyVm =
|
||||
&VM_IMAGE => 'ubuntu:16.04',
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.22.1',
|
||||
|
||||
&VMDEF_WITH_BACKTRACE => true,
|
||||
|
||||
@@ -394,7 +383,6 @@ my $oyVm =
|
||||
&VM_ARCH => VM_ARCH_AMD64,
|
||||
&VMDEF_COVERAGE_C => true,
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.26.1',
|
||||
|
||||
&VMDEF_WITH_BACKTRACE => true,
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ sub stanzaCreate
|
||||
|
||||
# Generate pg_control for stanza-create
|
||||
$self->controlGenerate($strDbPath, $strDbVersion);
|
||||
executeTest('sudo chmod 600 ' . $strDbPath . '/' . DB_FILE_PGCONTROL);
|
||||
executeTest('chmod 600 ' . $strDbPath . '/' . DB_FILE_PGCONTROL);
|
||||
|
||||
# Create the stanza repo paths if they don't exist
|
||||
if (!cfgOptionTest(CFGOPT_REPO_TYPE, CFGOPTVAL_REPO_TYPE_S3))
|
||||
@@ -237,7 +237,7 @@ sub stanzaUpgrade
|
||||
|
||||
# Copy pg_control for stanza-upgrade
|
||||
$self->controlGenerate(cfgOption(CFGOPT_PG_PATH), $strDbVersion);
|
||||
executeTest('sudo chmod 600 ' . cfgOption(CFGOPT_PG_PATH) . '/' . DB_FILE_PGCONTROL);
|
||||
executeTest('chmod 600 ' . cfgOption(CFGOPT_PG_PATH) . '/' . DB_FILE_PGCONTROL);
|
||||
|
||||
$self->stanzaSet($strStanza, $strDbVersion, true);
|
||||
|
||||
|
||||
@@ -78,15 +78,15 @@ sub new
|
||||
{
|
||||
$strName = HOST_BACKUP;
|
||||
$strImage = containerRepo() . ':' . testRunGet()->vm() . '-test';
|
||||
$strUser = testRunGet()->backrestUser();
|
||||
}
|
||||
else
|
||||
{
|
||||
$strName = $$oParam{strName};
|
||||
$strImage = $$oParam{strImage};
|
||||
$strUser = testRunGet()->pgUser();
|
||||
}
|
||||
|
||||
$strUser = testRunGet()->pgUser();
|
||||
|
||||
# Create the host
|
||||
my $self = $class->SUPER::new($strName, {strImage => $strImage, strUser => $strUser});
|
||||
bless $self, $class;
|
||||
@@ -1181,9 +1181,6 @@ sub configCreate
|
||||
|
||||
# Write out the configuration file
|
||||
storageTest()->put($self->backrestConfig(), iniRender(\%oParamHash, true));
|
||||
|
||||
# Modify the file permissions so it can be read/saved by all test users
|
||||
executeTest('sudo chmod 660 ' . $self->backrestConfig());
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
@@ -1217,17 +1214,8 @@ sub configUpdate
|
||||
}
|
||||
}
|
||||
|
||||
# Modify the file permissions so it can be saved by all test users
|
||||
executeTest(
|
||||
'sudo chmod 660 ' . $self->backrestConfig() . ' && sudo chmod 770 ' . dirname($self->backrestConfig()));
|
||||
|
||||
storageTest()->put($self->backrestConfig(), iniRender($oConfig, true));
|
||||
|
||||
# Fix permissions back to original
|
||||
executeTest(
|
||||
'sudo chmod 660 ' . $self->backrestConfig() . ' && sudo chmod 770 ' . dirname($self->backrestConfig()) .
|
||||
' && sudo chown ' . $self->userGet() . ' ' . $self->backrestConfig());
|
||||
|
||||
# Return from function and log return values if any
|
||||
return logDebugReturn($strOperation);
|
||||
}
|
||||
@@ -1368,23 +1356,9 @@ sub infoMunge
|
||||
}
|
||||
}
|
||||
|
||||
# Modify the file/directory permissions so it can be saved
|
||||
if ($self->isFS())
|
||||
{
|
||||
executeTest("sudo rm -f ${strFileName}* && sudo chmod 770 " . dirname($strFileName));
|
||||
}
|
||||
|
||||
# Save the munged data to the file
|
||||
$oMungeIni->save();
|
||||
|
||||
# Fix permissions
|
||||
if ($self->isFS())
|
||||
{
|
||||
executeTest(
|
||||
"sudo chmod 640 ${strFileName}* && sudo chmod 750 " . dirname($strFileName) .
|
||||
' && sudo chown ' . $self->userGet() . " ${strFileName}*");
|
||||
}
|
||||
|
||||
# Clear the cache is requested
|
||||
if (!$bCache)
|
||||
{
|
||||
@@ -1424,23 +1398,9 @@ sub infoRestore
|
||||
{
|
||||
if ($bSave)
|
||||
{
|
||||
# Modify the file/directory permissions so it can be saved
|
||||
if ($self->isFS())
|
||||
{
|
||||
executeTest("sudo rm -f ${strFileName}* && sudo chmod 770 " . dirname($strFileName));
|
||||
}
|
||||
|
||||
# Save the munged data to the file
|
||||
$self->{hInfoFile}{$strFileName}->{bModified} = true;
|
||||
$self->{hInfoFile}{$strFileName}->save();
|
||||
|
||||
# Fix permissions
|
||||
if ($self->isFS())
|
||||
{
|
||||
executeTest(
|
||||
"sudo chmod 640 ${strFileName} && sudo chmod 750 " . dirname($strFileName) .
|
||||
' && sudo chown ' . $self->userGet() . " ${strFileName}*");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1553,16 +1513,7 @@ sub configRemap
|
||||
# Save backup config file (but not if this is the standby which is not the source of backups)
|
||||
if (defined($oHostBackup))
|
||||
{
|
||||
# Modify the file permissions so it can be read/saved by all test users
|
||||
executeTest(
|
||||
'sudo chmod 660 ' . $oHostBackup->backrestConfig() . ' && sudo chmod 770 ' . dirname($oHostBackup->backrestConfig()));
|
||||
|
||||
storageTest()->put($oHostBackup->backrestConfig(), iniRender($oRemoteConfig, true));
|
||||
|
||||
# Fix permissions
|
||||
executeTest(
|
||||
'sudo chmod 660 ' . $oHostBackup->backrestConfig() . ' && sudo chmod 770 ' . dirname($oHostBackup->backrestConfig()) .
|
||||
' && sudo chown ' . $oHostBackup->userGet() . ' ' . $oHostBackup->backrestConfig());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ sub run
|
||||
"encryption incompatible for '$strArchiveFile'" .
|
||||
"\nHINT: is or was the repo encrypted?");
|
||||
|
||||
executeTest('sudo rm ' . $strArchiveFile);
|
||||
executeTest('rm ' . $strArchiveFile);
|
||||
|
||||
# Attempt to reconstruct from an encypted archived WAL with an encrypted repo
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -209,7 +209,7 @@ sub run
|
||||
"\nHINT: is or was the repo encrypted?");
|
||||
|
||||
# Remove the archive info files
|
||||
executeTest('sudo rm ' . $oArchiveInfo->{strFileName} . '*');
|
||||
executeTest('rm ' . $oArchiveInfo->{strFileName} . '*');
|
||||
|
||||
# Create an encrypted storage and archive.info file
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -220,7 +220,7 @@ sub run
|
||||
# Create encrypted files, change the passphrase and attempt to load - ensure flush error returned as parse error
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
# Remove the backup info files
|
||||
executeTest('sudo rm ' . $oBackupInfo->{strFileName} . '*');
|
||||
executeTest('rm ' . $oBackupInfo->{strFileName} . '*');
|
||||
|
||||
# Clear the storage repo settings and change the passphrase
|
||||
storageRepoCacheClear();
|
||||
|
||||
@@ -539,8 +539,7 @@ sub run
|
||||
}
|
||||
else
|
||||
{
|
||||
executeTest("sudo touch ${strTempFile}", {bRemote => $bRemote});
|
||||
executeTest("sudo chown " . BACKREST_USER . " ${strResumePath}/file.tmp");
|
||||
executeTest("touch ${strTempFile}", {bRemote => $bRemote});
|
||||
}
|
||||
|
||||
# Add zero-sized file
|
||||
|
||||
@@ -214,13 +214,7 @@ sub run
|
||||
substr($strSourceFile, 0, 16) . "/${strSourceFile}-${strArchiveChecksum}." . COMPRESS_EXT . qw{.} .
|
||||
STORAGE_TEMP_EXT;
|
||||
|
||||
executeTest('sudo chmod 770 ' . dirname($strArchiveTmp));
|
||||
storageTest()->put($strArchiveTmp, 'JUNK');
|
||||
|
||||
if ($bRemote)
|
||||
{
|
||||
executeTest('sudo chown ' . $oHostBackup->userGet() . " ${strArchiveTmp}");
|
||||
}
|
||||
}
|
||||
|
||||
# Push the WAL
|
||||
|
||||
Reference in New Issue
Block a user