This commit is contained in:
parent
7b8be800a4
commit
6098005f5d
3 changed files with 31 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -3,6 +3,8 @@
|
|||
* #697, #712: Extract borgmatic configuration from backup via "bootstrap" action—even when
|
||||
borgmatic has no configuration yet!
|
||||
* #669: Add sample systemd user service for running borgmatic as a non-root user.
|
||||
* #711, #713: Fix an error when "data" check time files are accessed without getting upgraded
|
||||
first.
|
||||
|
||||
1.7.14
|
||||
* #484: Add a new verbosity level (-2) to disable output entirely (for console, syslog, log file,
|
||||
|
|
|
@ -342,7 +342,7 @@ def upgrade_check_times(location_config, borg_repository_id):
|
|||
temporary_path = f'{old_path}.temp'
|
||||
|
||||
if not os.path.isfile(old_path) and not os.path.isfile(temporary_path):
|
||||
return
|
||||
continue
|
||||
|
||||
logger.debug(f'Upgrading archives check time from {old_path} to {new_path}')
|
||||
|
||||
|
|
|
@ -544,6 +544,34 @@ def test_upgrade_check_times_renames_old_check_paths_to_all():
|
|||
module.upgrade_check_times(flexmock(), flexmock())
|
||||
|
||||
|
||||
def test_upgrade_check_times_renames_data_check_paths_when_archives_paths_are_already_upgraded():
|
||||
base_path = '~/.borgmatic/checks/1234'
|
||||
flexmock(module).should_receive('make_check_time_path').with_args(
|
||||
object, object, 'archives', 'all'
|
||||
).and_return(f'{base_path}/archives/all')
|
||||
flexmock(module).should_receive('make_check_time_path').with_args(
|
||||
object, object, 'data', 'all'
|
||||
).and_return(f'{base_path}/data/all')
|
||||
flexmock(module.os.path).should_receive('isfile').with_args(f'{base_path}/archives').and_return(
|
||||
False
|
||||
)
|
||||
flexmock(module.os.path).should_receive('isfile').with_args(
|
||||
f'{base_path}/archives.temp'
|
||||
).and_return(False)
|
||||
flexmock(module.os.path).should_receive('isfile').with_args(f'{base_path}/data').and_return(
|
||||
True
|
||||
)
|
||||
flexmock(module.os).should_receive('rename').with_args(
|
||||
f'{base_path}/data', f'{base_path}/data.temp'
|
||||
).once()
|
||||
flexmock(module.os).should_receive('mkdir').with_args(f'{base_path}/data').once()
|
||||
flexmock(module.os).should_receive('rename').with_args(
|
||||
f'{base_path}/data.temp', f'{base_path}/data/all'
|
||||
).once()
|
||||
|
||||
module.upgrade_check_times(flexmock(), flexmock())
|
||||
|
||||
|
||||
def test_upgrade_check_times_skips_missing_check_paths():
|
||||
flexmock(module).should_receive('make_check_time_path').and_return(
|
||||
'~/.borgmatic/checks/1234/archives/all'
|
||||
|
|
Loading…
Reference in a new issue