Fix generate-borgmatic-config with "--source" flag to support more complex schema changes like the new Healthchecks configuration options (#536).

This commit is contained in:
Dan Helfman 2022-05-25 10:26:26 -07:00
parent 37327379bc
commit be59a3e574
4 changed files with 8 additions and 2 deletions

4
NEWS
View file

@ -1,3 +1,7 @@
1.6.2.dev0
* #536: Fix generate-borgmatic-config with "--source" flag to support more complex schema changes
like the new Healthchecks configuration options.
1.6.1 1.6.1
* #294: Add Healthchecks monitoring hook "ping_body_limit" option to configure how many bytes of * #294: Add Healthchecks monitoring hook "ping_body_limit" option to configure how many bytes of
logs to send to the Healthchecks server. logs to send to the Healthchecks server.

View file

@ -5,7 +5,7 @@ import re
from ruamel import yaml from ruamel import yaml
from borgmatic.config import load from borgmatic.config import load, normalize
INDENT = 4 INDENT = 4
SEQUENCE_INDENT = 2 SEQUENCE_INDENT = 2
@ -275,6 +275,7 @@ def generate_sample_configuration(source_filename, destination_filename, schema_
if source_filename: if source_filename:
source_config = load.load_configuration(source_filename) source_config = load.load_configuration(source_filename)
normalize.normalize(source_config)
destination_config = merge_source_configuration_into_destination( destination_config = merge_source_configuration_into_destination(
_schema_to_sample_configuration(schema), source_config _schema_to_sample_configuration(schema), source_config

View file

@ -1,6 +1,6 @@
from setuptools import find_packages, setup from setuptools import find_packages, setup
VERSION = '1.6.1' VERSION = '1.6.2.dev0'
setup( setup(

View file

@ -212,6 +212,7 @@ def test_generate_sample_configuration_with_source_filename_does_not_raise():
builtins.should_receive('open').with_args('schema.yaml').and_return('') builtins.should_receive('open').with_args('schema.yaml').and_return('')
flexmock(module.yaml).should_receive('round_trip_load') flexmock(module.yaml).should_receive('round_trip_load')
flexmock(module.load).should_receive('load_configuration') flexmock(module.load).should_receive('load_configuration')
flexmock(module.normalize).should_receive('normalize')
flexmock(module).should_receive('_schema_to_sample_configuration') flexmock(module).should_receive('_schema_to_sample_configuration')
flexmock(module).should_receive('merge_source_configuration_into_destination') flexmock(module).should_receive('merge_source_configuration_into_destination')
flexmock(module).should_receive('render_configuration') flexmock(module).should_receive('render_configuration')