Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use TarSafe for extracting backup tarball #57

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tutorbackup/templates/backup/build/backup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | gpg --dearmor
apt-get update && \
apt-get install -y --no-install-recommends default-mysql-client mongodb-org-tools && \
pip install --upgrade pip && \
pip install boto3 click && \
pip install boto3 tarsafe click && \
mkdir data backup

COPY backup_services.py .
Expand Down
4 changes: 2 additions & 2 deletions tutorbackup/templates/backup/build/backup/restore_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import os
import shutil
import sys
import tarfile
from datetime import datetime
from pathlib import Path
from subprocess import check_call

import click
from botocore.exceptions import ClientError
from tarsafe import TarSafe


ENV = os.environ
Expand Down Expand Up @@ -98,7 +98,7 @@ def extract(file_name):

logger.info(f"Extracting archive {file_name} to {out_dir}")
try:
with tarfile.open(file_name, "r:xz") as tar:
with TarSafe.open(file_name, "r:xz") as tar:
tar.extractall()
except FileNotFoundError as e:
logger.exception(e, exc_info=True)
Expand Down