diff --git a/borgmatic/hooks/zfs.py b/borgmatic/hooks/zfs.py index 1e7cf822..bfc52b3a 100644 --- a/borgmatic/hooks/zfs.py +++ b/borgmatic/hooks/zfs.py @@ -92,13 +92,7 @@ def dump_data_sources( # Mount the snapshot into a particular named temporary directory so that the snapshot ends # up in the Borg archive at the "original" dataset mount point path. snapshot_path = os.path.join( - # TODO: Maybe factor out into normalize_runtime_directory() utility function. - '/', - *( - subdirectory - for subdirectory in borgmatic_runtime_directory.split(os.path.sep) - if subdirectory != '.' - ), + os.path.normpath(borgmatic_runtime_directory), 'zfs_snapshots', '.', mount_point.lstrip(os.path.sep), @@ -154,12 +148,7 @@ def remove_data_source_dumps(hook_config, config, log_prefix, borgmatic_runtime_ # FIXME: This doesn't necessarily find snapshot mounts from previous borgmatic runs, because # borgmatic_runtime_directory could be in a tempfile-created directory that has a random name. snapshots_directory = os.path.join( - '/', - *( - subdirectory - for subdirectory in borgmatic_runtime_directory.split(os.path.sep) - if subdirectory != '.' - ), + os.path.normpath(borgmatic_runtime_directory), 'zfs_snapshots', ) logger.debug(f'{log_prefix}: Looking for snapshots in {snapshots_directory}')