Fix normalization of deprecated sections to support empty sections without erroring (#771).

This commit is contained in:
Dan Helfman 2023-10-14 13:04:18 -07:00
parent 30523a7c89
commit 487d8ffd32
3 changed files with 8 additions and 1 deletions

2
NEWS
View file

@ -3,6 +3,8 @@
Apprise library. See the documentation for more information:
https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#apprise-hook
* #768: Fix a traceback when an invalid command-line flag or action is used.
* #771: Fix normalization of deprecated sections ("location:", "storage:", "hooks:", etc.) to
support empty sections without erroring.
1.8.3
* #665: BREAKING: Simplify logging logic as follows: Syslog verbosity is now disabled by

View file

@ -39,7 +39,7 @@ def normalize_sections(config_filename, config):
for section_name in ('location', 'storage', 'retention', 'consistency', 'output', 'hooks'):
section_config = config.get(section_name)
if section_config:
if section_config is not None:
any_section_upgraded = True
del config[section_name]
config.update(section_config)

View file

@ -77,6 +77,11 @@ from borgmatic.config import normalize as module
{'bar': 'baz', 'prefix': 'foo'},
True,
),
(
{'location': {}, 'consistency': {'prefix': 'foo'}},
{'prefix': 'foo'},
True,
),
(
{},
{},