From f563ddece04adfd8d80d4e984405f5c70a6c94f3 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 2 Nov 2022 18:20:24 +0100 Subject: surtr: borg backup to vidhar --- modules/borgsnap/borgsnap/borgsnap/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/borgsnap') diff --git a/modules/borgsnap/borgsnap/borgsnap/__main__.py b/modules/borgsnap/borgsnap/borgsnap/__main__.py index 91144780..ad46a7bf 100644 --- a/modules/borgsnap/borgsnap/borgsnap/__main__.py +++ b/modules/borgsnap/borgsnap/borgsnap/__main__.py @@ -246,7 +246,9 @@ def create(*, snapshot, target, archive_prefix, dry_run): env['BORG_FILES_CACHE_SUFFIX'] = basename archive_name = _archive_name(snapshot, target, archive_prefix) target_host, _, target_path = target.rpartition(':') - *parents_init, _ = list(Path(target_path).parents) + parents_init = list() + if Path(target_path).parents: + *parents_init, _ = list(Path(target_path).parents) backup_patterns = [*(map(lambda p: Path('.backup') / f'{target_host}:{p}', [Path(target_path), *parents_init])), Path('.backup') / target_host, Path('.backup')] for pattern_file in backup_patterns: if (dir / pattern_file).is_file(): -- cgit v1.2.3