Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48195d1

Browse files
committed
Add a backup directory prefix variable
1 parent fb0ee44 commit 48195d1

File tree

1 file changed

+5
-4
lines changed
  • testgres/plugins/pg_probackup2/pg_probackup2/storage

1 file changed

+5
-4
lines changed

testgres/plugins/pg_probackup2/pg_probackup2/storage/fs_backup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ class FSTestBackupDir(TestBackupDir):
4242

4343
""" Backup directory. Usually created by running pg_probackup init -B <path>"""
4444

45-
def __init__(self, *, path, backup):
46-
if os.path.isabs(path):
47-
self.path = os.path.join(path, backup)
45+
def __init__(self, *, rel_path, backup):
46+
backup_prefix = os.environ.get('PG_PROBACKUP_TEST_BACKUP_DIR_PREFIX', '')
47+
if os.path.isabs(backup_prefix):
48+
self.path = os.path.join(backup_prefix, rel_path, backup)
4849
else:
49-
self.path = os.path.join(init_params.tmp_path, path, backup)
50+
self.path = os.path.join(init_params.tmp_path, backup_prefix, rel_path, backup)
5051
self.pb_args = ('-B', self.path)
5152

5253
def list_instance_backups(self, instance):

0 commit comments

Comments
 (0)