Allow tar to open the private mailbox snapshot directory
This commit is contained in:
1 parent
766477214b
commit
7a1602e5b0
2 files changed
+15
-1
No files matched your search
@@ -142,6 +142,19 @@ class MailboxBackupTests(SimpleTestCase):
|
|||||||
|
|
||||||
self.assertFalse((self.home / "Maildir").exists())
|
self.assertFalse((self.home / "Maildir").exists())
|
||||||
|
|
||||||
|
def test_archive_can_read_the_root_owned_snapshot_directory(self):
|
||||||
|
def archive(directory, account, output):
|
||||||
|
self.assertEqual(stat.S_IMODE(directory.stat().st_mode), 0o750)
|
||||||
|
os.chown.assert_any_call(directory, 0, account.pw_gid)
|
||||||
|
|
||||||
|
with (
|
||||||
|
patch.object(mail_node_backup, "copy_mailbox"),
|
||||||
|
patch.object(
|
||||||
|
mail_node_backup, "archive_snapshot", side_effect=archive
|
||||||
|
),
|
||||||
|
):
|
||||||
|
mail_node_backup.backup_mailbox(self.mailbox, self.archive)
|
||||||
|
|
||||||
def test_incomplete_dovecot_sync_leaves_no_archive(self):
|
def test_incomplete_dovecot_sync_leaves_no_archive(self):
|
||||||
with (
|
with (
|
||||||
patch.object(mail_node_backup.subprocess, "run") as command,
|
patch.object(mail_node_backup.subprocess, "run") as command,
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ def backup_mailbox(mailbox, archive):
|
|||||||
TemporaryDirectory(dir=home.parent) as directory,
|
TemporaryDirectory(dir=home.parent) as directory,
|
||||||
):
|
):
|
||||||
scratch = Path(directory)
|
scratch = Path(directory)
|
||||||
scratch.chmod(0o711)
|
os.chown(scratch, 0, account.pw_gid)
|
||||||
|
scratch.chmod(0o750)
|
||||||
snapshot = scratch / MAILDIR
|
snapshot = scratch / MAILDIR
|
||||||
mail_node_apply.ensure_mail_home(snapshot, account, create=True)
|
mail_node_apply.ensure_mail_home(snapshot, account, create=True)
|
||||||
copy_mailbox(mailbox, snapshot)
|
copy_mailbox(mailbox, snapshot)
|
||||||
|
|||||||
Reference in new issue
Block a user