Skip to content

Commit 9322ff1

Browse files
committed
Bug fix: Skip human friendly pathname formatting for remote backups
1 parent 0983e64 commit 9322ff1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

rotate_backups/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,17 @@ class together to implement backup rotation with an easy to use Python
438438
backups_to_preserve = self.find_preservation_criteria(backups_by_frequency)
439439
# Apply the calculated rotation scheme.
440440
for backup in sorted_backups:
441+
friendly_name = backup.pathname
442+
if not location.is_remote:
443+
# Use human friendly pathname formatting for local backups.
444+
friendly_name = format_path(backup.pathname)
441445
if backup in backups_to_preserve:
442446
matching_periods = backups_to_preserve[backup]
443447
logger.info("Preserving %s (matches %s retention %s) ..",
444-
format_path(backup.pathname),
445-
concatenate(map(repr, matching_periods)),
448+
friendly_name, concatenate(map(repr, matching_periods)),
446449
"period" if len(matching_periods) == 1 else "periods")
447450
else:
448-
logger.info("Deleting %s ..", format_path(backup.pathname))
451+
logger.info("Deleting %s ..", friendly_name)
449452
if not self.dry_run:
450453
command = location.context.prepare(
451454
'rm', '-Rf', backup.pathname,
@@ -456,7 +459,7 @@ class together to implement backup rotation with an easy to use Python
456459
if not prepare:
457460
timer = Timer()
458461
command.wait()
459-
logger.verbose("Deleted %s in %s.", format_path(backup.pathname), timer)
462+
logger.verbose("Deleted %s in %s.", friendly_name, timer)
460463
if len(backups_to_preserve) == len(sorted_backups):
461464
logger.info("Nothing to do! (all backups preserved)")
462465
return rotation_commands

0 commit comments

Comments
 (0)