Skip to content

Commit

Permalink
backup: add function parameter for override temp directory
Browse files Browse the repository at this point in the history
This will be useful for tests.

QubesOS/qubes-issues#
  • Loading branch information
marmarek committed Jan 5, 2021
1 parent 25a6a30 commit d906fbc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions qubesadmin/backup/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

'''Backup restore module'''

import contextlib
import errno
import fcntl
import functools
Expand Down Expand Up @@ -910,7 +911,8 @@ def __init__(self, vm, subdir=None):
self.username = os.path.basename(subdir)

def __init__(self, app, backup_location, backup_vm, passphrase,
location_is_service=False, force_compression_filter=None):
location_is_service=False, force_compression_filter=None,
tmpdir="/var/tmp"):
super().__init__()

#: qubes.Qubes instance
Expand Down Expand Up @@ -940,7 +942,7 @@ def __init__(self, app, backup_location, backup_vm, passphrase,

#: temporary directory used to extract the data before moving to the
# final location
self.tmpdir = tempfile.mkdtemp(prefix="restore", dir="/var/tmp")
self.tmpdir = tempfile.mkdtemp(prefix="restore", dir=tmpdir)

#: list of processes (Popen objects) to kill on cancel
self.processes_to_kill_on_cancel = []
Expand Down

0 comments on commit d906fbc

Please sign in to comment.