Compare commits

...
3 Commits
6 changed files with 28 additions and 8 deletions
+1
View File
@@ -30,3 +30,4 @@ dbc96d3f83bd5570b6826537616d4160b3374836 0.1.8
de2d7721cdec93a52d20222a9ddd579ed93c1017 1.0.1
9603d13910b32d57a887765cab694ac5d0acc1f4 1.0.2
32c6341dda9fad77a3982641bce8a3a45821842e 1.0.3
5a003056a8ff4709c5bd4d6d33354199423f8a1d 1.1.0
+6
View File
@@ -1,3 +1,9 @@
1.1.1
* #32: Fix for upgrade-borgmatic-config converting check_last option as a string instead of an
integer.
* Fix for upgrade-borgmatic-config erroring when consistency checks option is not present.
1.1.0
* Switched config file format to YAML. Run upgrade-borgmatic-config to upgrade.
+10 -4
View File
@@ -10,10 +10,16 @@ def _convert_section(source_section_config, section_schema):
Given a legacy Parsed_config instance for a single section, convert it to its corresponding
yaml.comments.CommentedMap representation in preparation for actual serialization to YAML.
Additionally, use the section schema as a source of helpful comments to include within the
returned CommentedMap.
Where integer types exist in the given section schema, convert their values to integers.
'''
destination_section_config = yaml.comments.CommentedMap(source_section_config)
destination_section_config = yaml.comments.CommentedMap([
(
option_name,
int(option_value)
if section_schema['map'].get(option_name, {}).get('type') == 'int' else option_value
)
for option_name, option_value in source_section_config.items()
])
return destination_section_config
@@ -39,7 +45,7 @@ def convert_legacy_parsed_config(source_config, source_excludes, schema):
location['repositories'] = [location.pop('repository')]
location['exclude_patterns'] = source_excludes
if source_config.consistency['checks']:
if source_config.consistency.get('checks'):
destination_config['consistency']['checks'] = source_config.consistency['checks'].split(' ')
# Add comments to each section, and then add comments to the fields in each section.
@@ -10,6 +10,16 @@ from borgmatic.config import convert as module
Parsed_config = namedtuple('Parsed_config', ('location', 'storage', 'retention', 'consistency'))
def test_convert_section_generates_integer_value_for_integer_type_in_schema():
flexmock(module.yaml.comments).should_receive('CommentedMap').replace_with(OrderedDict)
source_section_config = OrderedDict([('check_last', '3')])
section_schema = {'map': {'check_last': {'type': 'int'}}}
destination_config = module._convert_section(source_section_config, section_schema)
assert destination_config == OrderedDict([('check_last', 3)])
def test_convert_legacy_parsed_config_transforms_source_config_to_mapping():
flexmock(module.yaml.comments).should_receive('CommentedMap').replace_with(OrderedDict)
source_config = Parsed_config(
-3
View File
@@ -1,5 +1,2 @@
[metadata]
description-file=README.md
[bdist_wheel]
universal=1
+1 -1
View File
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
VERSION = '1.1.0'
VERSION = '1.1.1'
setup(