Fix Borg usage error in the "compact" action when running "borgmatic --dry-run". Now, skip "compact" entirely during a dry run (#507).
This commit is contained in:
parent
28fef3264b
commit
574eb91921
3 changed files with 8 additions and 6 deletions
6
NEWS
6
NEWS
|
@ -1,7 +1,9 @@
|
||||||
1.5.24.dev0
|
1.5.24.dev0
|
||||||
* Add "working_directory" option to support source directories with relative paths (#431).
|
* #431: Add "working_directory" option to support source directories with relative paths.
|
||||||
* #486: Fix handling of "patterns_from" and "exclude_from" options to error instead of warning when
|
* #486: Fix handling of "patterns_from" and "exclude_from" options to error instead of warning when
|
||||||
referencing unreadable files and running "create" action.
|
referencing unreadable files and "create" action is run.
|
||||||
|
* #507: Fix Borg usage error in the "compact" action when running "borgmatic --dry-run". Now, skip
|
||||||
|
"compact" entirely during a dry run.
|
||||||
|
|
||||||
1.5.23
|
1.5.23
|
||||||
* #394: Compact repository segments and free space with new "borgmatic compact" action. Borg 1.2+
|
* #394: Compact repository segments and free space with new "borgmatic compact" action. Borg 1.2+
|
||||||
|
|
|
@ -33,9 +33,9 @@ def compact_segments(
|
||||||
+ (('--threshold', str(threshold)) if threshold else ())
|
+ (('--threshold', str(threshold)) if threshold else ())
|
||||||
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
|
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
|
||||||
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
|
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
|
||||||
+ (('--dry-run',) if dry_run else ())
|
|
||||||
+ (tuple(extra_borg_options.split(' ')) if extra_borg_options else ())
|
+ (tuple(extra_borg_options.split(' ')) if extra_borg_options else ())
|
||||||
+ (repository,)
|
+ (repository,)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not dry_run:
|
||||||
execute_command(full_command, output_log_level=logging.INFO, borg_local_path=local_path)
|
execute_command(full_command, output_log_level=logging.INFO, borg_local_path=local_path)
|
||||||
|
|
|
@ -36,8 +36,8 @@ def test_compact_segments_with_log_debug_calls_borg_with_debug_parameter():
|
||||||
module.compact_segments(repository='repo', storage_config={}, dry_run=False)
|
module.compact_segments(repository='repo', storage_config={}, dry_run=False)
|
||||||
|
|
||||||
|
|
||||||
def test_compact_segments_with_dry_run_calls_borg_with_dry_run_parameter():
|
def test_compact_segments_with_dry_run_skips_borg_call():
|
||||||
insert_execute_command_mock(COMPACT_COMMAND + ('--dry-run', 'repo'), logging.INFO)
|
flexmock(module).should_receive('execute_command').never()
|
||||||
|
|
||||||
module.compact_segments(repository='repo', storage_config={}, dry_run=True)
|
module.compact_segments(repository='repo', storage_config={}, dry_run=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue