Fix regression of generate-borgmatic-config working without --source flag (#239).

This commit is contained in:
Dan Helfman 2019-11-06 09:52:21 -08:00
parent 31d3bc9bd8
commit ac777965d0
2 changed files with 11 additions and 0 deletions

View file

@ -230,6 +230,8 @@ def merge_source_configuration_into_destination(destination_config, source_confi
new new
configuration keys and comments. configuration keys and comments.
''' '''
if not source_config:
return destination_config
if not destination_config or not isinstance(source_config, collections.abc.Mapping): if not destination_config or not isinstance(source_config, collections.abc.Mapping):
return source_config return source_config

View file

@ -123,3 +123,12 @@ def test_merge_source_configuration_into_destination_inserts_sequence_of_maps():
'foo': [{'first': 'source1', 'second': 'dest2'}, {'other': 'source2'}], 'foo': [{'first': 'source1', 'second': 'dest2'}, {'other': 'source2'}],
'bar': 'dest3', 'bar': 'dest3',
} }
def test_merge_source_configuration_into_destination_without_source_does_nothing():
original_destination_config = {'foo': 'dest1', 'bar': 'dest2'}
destination_config = dict(original_destination_config)
module.merge_source_configuration_into_destination(destination_config, None)
assert destination_config == original_destination_config