Basic YAML configuration file parsing.
This commit is contained in:
parent
9212f87735
commit
4d7556f68b
16 changed files with 203 additions and 15 deletions
|
|
@ -2,6 +2,7 @@ syntax: glob
|
|||
*.egg-info
|
||||
*.pyc
|
||||
*.swp
|
||||
.cache
|
||||
.tox
|
||||
build
|
||||
dist
|
||||
|
|
|
|||
1
MANIFEST.in
Normal file
1
MANIFEST.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
include borgmatic/config/schema.yaml
|
||||
2
NEWS
2
NEWS
|
|
@ -1,4 +1,4 @@
|
|||
1.0.3-dev
|
||||
1.1.0
|
||||
|
||||
* #18: Fix for README mention of sample files not included in package.
|
||||
* #22: Sample files for triggering borgmatic from a systemd timer.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from subprocess import CalledProcessError
|
|||
import sys
|
||||
|
||||
from borgmatic import borg
|
||||
from borgmatic.config import parse_configuration, CONFIG_FORMAT
|
||||
from borgmatic.config.legacy import parse_configuration, CONFIG_FORMAT
|
||||
|
||||
|
||||
DEFAULT_CONFIG_FILENAME = '/etc/borgmatic/config'
|
||||
|
|
|
|||
0
borgmatic/config/__init__.py
Normal file
0
borgmatic/config/__init__.py
Normal file
161
borgmatic/config/legacy.py
Normal file
161
borgmatic/config/legacy.py
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
from collections import OrderedDict, namedtuple
|
||||
from configparser import RawConfigParser
|
||||
|
||||
|
||||
Section_format = namedtuple('Section_format', ('name', 'options'))
|
||||
Config_option = namedtuple('Config_option', ('name', 'value_type', 'required'))
|
||||
|
||||
|
||||
def option(name, value_type=str, required=True):
|
||||
'''
|
||||
Given a config file option name, an expected type for its value, and whether it's required,
|
||||
return a Config_option capturing that information.
|
||||
'''
|
||||
return Config_option(name, value_type, required)
|
||||
|
||||
|
||||
CONFIG_FORMAT = (
|
||||
Section_format(
|
||||
'location',
|
||||
(
|
||||
option('source_directories'),
|
||||
option('one_file_system', value_type=bool, required=False),
|
||||
option('remote_path', required=False),
|
||||
option('repository'),
|
||||
),
|
||||
),
|
||||
Section_format(
|
||||
'storage',
|
||||
(
|
||||
option('encryption_passphrase', required=False),
|
||||
option('compression', required=False),
|
||||
option('umask', required=False),
|
||||
),
|
||||
),
|
||||
Section_format(
|
||||
'retention',
|
||||
(
|
||||
option('keep_within', required=False),
|
||||
option('keep_hourly', int, required=False),
|
||||
option('keep_daily', int, required=False),
|
||||
option('keep_weekly', int, required=False),
|
||||
option('keep_monthly', int, required=False),
|
||||
option('keep_yearly', int, required=False),
|
||||
option('prefix', required=False),
|
||||
),
|
||||
),
|
||||
Section_format(
|
||||
'consistency',
|
||||
(
|
||||
option('checks', required=False),
|
||||
option('check_last', required=False),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def validate_configuration_format(parser, config_format):
|
||||
'''
|
||||
Given an open RawConfigParser and an expected config file format, validate that the parsed
|
||||
configuration file has the expected sections, that any required options are present in those
|
||||
sections, and that there aren't any unexpected options.
|
||||
|
||||
A section is required if any of its contained options are required.
|
||||
|
||||
Raise ValueError if anything is awry.
|
||||
'''
|
||||
section_names = set(parser.sections())
|
||||
required_section_names = tuple(
|
||||
section.name for section in config_format
|
||||
if any(option.required for option in section.options)
|
||||
)
|
||||
|
||||
unknown_section_names = section_names - set(
|
||||
section_format.name for section_format in config_format
|
||||
)
|
||||
if unknown_section_names:
|
||||
raise ValueError(
|
||||
'Unknown config sections found: {}'.format(', '.join(unknown_section_names))
|
||||
)
|
||||
|
||||
missing_section_names = set(required_section_names) - section_names
|
||||
if missing_section_names:
|
||||
raise ValueError(
|
||||
'Missing config sections: {}'.format(', '.join(missing_section_names))
|
||||
)
|
||||
|
||||
for section_format in config_format:
|
||||
if section_format.name not in section_names:
|
||||
continue
|
||||
|
||||
option_names = parser.options(section_format.name)
|
||||
expected_options = section_format.options
|
||||
|
||||
unexpected_option_names = set(option_names) - set(option.name for option in expected_options)
|
||||
|
||||
if unexpected_option_names:
|
||||
raise ValueError(
|
||||
'Unexpected options found in config section {}: {}'.format(
|
||||
section_format.name,
|
||||
', '.join(sorted(unexpected_option_names)),
|
||||
)
|
||||
)
|
||||
|
||||
missing_option_names = tuple(
|
||||
option.name for option in expected_options if option.required
|
||||
if option.name not in option_names
|
||||
)
|
||||
|
||||
if missing_option_names:
|
||||
raise ValueError(
|
||||
'Required options missing from config section {}: {}'.format(
|
||||
section_format.name,
|
||||
', '.join(missing_option_names)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def parse_section_options(parser, section_format):
|
||||
'''
|
||||
Given an open RawConfigParser and an expected section format, return the option values from that
|
||||
section as a dict mapping from option name to value. Omit those options that are not present in
|
||||
the parsed options.
|
||||
|
||||
Raise ValueError if any option values cannot be coerced to the expected Python data type.
|
||||
'''
|
||||
type_getter = {
|
||||
str: parser.get,
|
||||
int: parser.getint,
|
||||
bool: parser.getboolean,
|
||||
}
|
||||
|
||||
return OrderedDict(
|
||||
(option.name, type_getter[option.value_type](section_format.name, option.name))
|
||||
for option in section_format.options
|
||||
if parser.has_option(section_format.name, option.name)
|
||||
)
|
||||
|
||||
|
||||
def parse_configuration(config_filename, config_format):
|
||||
'''
|
||||
Given a config filename and an expected config file format, return the parsed configuration
|
||||
as a namedtuple with one attribute for each parsed section.
|
||||
|
||||
Raise IOError if the file cannot be read, or ValueError if the format is not as expected.
|
||||
'''
|
||||
parser = RawConfigParser()
|
||||
if not parser.read(config_filename):
|
||||
raise ValueError('Configuration file cannot be opened: {}'.format(config_filename))
|
||||
|
||||
validate_configuration_format(parser, config_format)
|
||||
|
||||
# Describes a parsed configuration, where each attribute is the name of a configuration file
|
||||
# section and each value is a dict of that section's parsed options.
|
||||
Parsed_config = namedtuple('Parsed_config', (section_format.name for section_format in config_format))
|
||||
|
||||
return Parsed_config(
|
||||
*(
|
||||
parse_section_options(parser, section_format)
|
||||
for section_format in config_format
|
||||
)
|
||||
)
|
||||
48
borgmatic/config/schema.yaml
Normal file
48
borgmatic/config/schema.yaml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
map:
|
||||
location:
|
||||
required: True
|
||||
map:
|
||||
source_directories:
|
||||
required: True
|
||||
seq:
|
||||
- type: scalar
|
||||
one_file_system:
|
||||
type: bool
|
||||
remote_path:
|
||||
type: scalar
|
||||
repository:
|
||||
required: True
|
||||
type: scalar
|
||||
storage:
|
||||
map:
|
||||
encryption_passphrase:
|
||||
type: scalar
|
||||
compression:
|
||||
type: scalar
|
||||
umask:
|
||||
type: scalar
|
||||
retention:
|
||||
map:
|
||||
keep_within:
|
||||
type: scalar
|
||||
keep_hourly:
|
||||
type: int
|
||||
keep_daily:
|
||||
type: int
|
||||
keep_weekly:
|
||||
type: int
|
||||
keep_monthly:
|
||||
type: int
|
||||
keep_yearly:
|
||||
type: int
|
||||
prefix:
|
||||
type: scalar
|
||||
consistency:
|
||||
map:
|
||||
checks:
|
||||
seq:
|
||||
- type: str
|
||||
enum: ['repository', 'archives', 'disabled']
|
||||
unique: True
|
||||
check_last:
|
||||
type: int
|
||||
84
borgmatic/config/yaml.py
Normal file
84
borgmatic/config/yaml.py
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
import logging
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
import pkg_resources
|
||||
import pykwalify.core
|
||||
import pykwalify.errors
|
||||
import ruamel.yaml.error
|
||||
|
||||
|
||||
def schema_filename():
|
||||
'''
|
||||
Path to the installed YAML configuration schema file, used to validate and parse the
|
||||
configuration.
|
||||
'''
|
||||
return pkg_resources.resource_filename('borgmatic', 'config/schema.yaml')
|
||||
|
||||
|
||||
class Validation_error(ValueError):
|
||||
'''
|
||||
A collection of error message strings generated when attempting to validate a particular
|
||||
configurartion file.
|
||||
'''
|
||||
def __init__(self, config_filename, error_messages):
|
||||
self.config_filename = config_filename
|
||||
self.error_messages = error_messages
|
||||
|
||||
|
||||
def parse_configuration(config_filename, schema_filename):
|
||||
'''
|
||||
Given the path to a config filename in YAML format and the path to a schema filename in
|
||||
pykwalify YAML schema format, return the parsed configuration as a data structure of nested
|
||||
dicts and lists corresponding to the schema. Example return value:
|
||||
|
||||
{'location': {'source_directories': ['/home', '/etc'], 'repository': 'hostname.borg'},
|
||||
'retention': {'keep_daily': 7}, 'consistency': {'checks': ['repository', 'archives']}}
|
||||
|
||||
Raise FileNotFoundError if the file does not exist, PermissionError if the user does not
|
||||
have permissions to read the file, or Validation_error if the config does not match the schema.
|
||||
'''
|
||||
warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)
|
||||
logging.getLogger('pykwalify').setLevel(logging.CRITICAL)
|
||||
|
||||
try:
|
||||
validator = pykwalify.core.Core(source_file=config_filename, schema_files=[schema_filename])
|
||||
except pykwalify.errors.CoreError as error:
|
||||
if 'do not exists on disk' in str(error):
|
||||
raise FileNotFoundError("No such file or directory: '{}'".format(config_filename))
|
||||
if 'Unable to load any data' in str(error):
|
||||
# If the YAML file has a syntax error, pykwalify's exception is particularly unhelpful.
|
||||
# So reach back to the originating exception from ruamel.yaml for something more useful.
|
||||
raise Validation_error(config_filename, (error.__context__,))
|
||||
raise
|
||||
|
||||
parsed_result = validator.validate(raise_exception=False)
|
||||
|
||||
if validator.validation_errors:
|
||||
raise Validation_error(config_filename, validator.validation_errors)
|
||||
|
||||
return parsed_result
|
||||
|
||||
|
||||
def display_validation_error(validation_error):
|
||||
'''
|
||||
Given a Validation_error, display its error messages to stderr.
|
||||
'''
|
||||
print(
|
||||
'An error occurred while parsing a configuration file at {}:'.format(
|
||||
validation_error.config_filename
|
||||
),
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
for error in validation_error.error_messages:
|
||||
print(error, file=sys.stderr)
|
||||
|
||||
|
||||
# FOR TESTING
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
configuration = parse_configuration('sample/config.yaml', schema_filename())
|
||||
print(configuration)
|
||||
except Validation_error as error:
|
||||
display_validation_error(error)
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
from flexmock import flexmock
|
||||
import sys
|
||||
|
||||
|
||||
def builtins_mock():
|
||||
return flexmock(sys.modules['builtins'])
|
||||
0
borgmatic/tests/integration/config/__init__.py
Normal file
0
borgmatic/tests/integration/config/__init__.py
Normal file
24
borgmatic/tests/integration/config/test_legacy.py
Normal file
24
borgmatic/tests/integration/config/test_legacy.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from io import StringIO
|
||||
|
||||
from collections import OrderedDict
|
||||
import string
|
||||
|
||||
from borgmatic.config import legacy as module
|
||||
|
||||
|
||||
def test_parse_section_options_with_punctuation_should_return_section_options():
|
||||
parser = module.RawConfigParser()
|
||||
parser.readfp(StringIO('[section]\nfoo: {}\n'.format(string.punctuation)))
|
||||
|
||||
section_format = module.Section_format(
|
||||
'section',
|
||||
(module.Config_option('foo', str, required=True),),
|
||||
)
|
||||
|
||||
config = module.parse_section_options(parser, section_format)
|
||||
|
||||
assert config == OrderedDict(
|
||||
(
|
||||
('foo', string.punctuation),
|
||||
)
|
||||
)
|
||||
0
borgmatic/tests/unit/config/__init__.py
Normal file
0
borgmatic/tests/unit/config/__init__.py
Normal file
232
borgmatic/tests/unit/config/test_legacy.py
Normal file
232
borgmatic/tests/unit/config/test_legacy.py
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
|
||||
from borgmatic.config import legacy as module
|
||||
|
||||
|
||||
def test_option_should_create_config_option():
|
||||
option = module.option('name', bool, required=False)
|
||||
|
||||
assert option == module.Config_option('name', bool, False)
|
||||
|
||||
|
||||
def test_option_should_create_config_option_with_defaults():
|
||||
option = module.option('name')
|
||||
|
||||
assert option == module.Config_option('name', str, True)
|
||||
|
||||
|
||||
def test_validate_configuration_format_with_valid_config_should_not_raise():
|
||||
parser = flexmock()
|
||||
parser.should_receive('sections').and_return(('section', 'other'))
|
||||
parser.should_receive('options').with_args('section').and_return(('stuff',))
|
||||
parser.should_receive('options').with_args('other').and_return(('such',))
|
||||
config_format = (
|
||||
module.Section_format(
|
||||
'section',
|
||||
options=(
|
||||
module.Config_option('stuff', str, required=True),
|
||||
),
|
||||
),
|
||||
module.Section_format(
|
||||
'other',
|
||||
options=(
|
||||
module.Config_option('such', str, required=True),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
module.validate_configuration_format(parser, config_format)
|
||||
|
||||
|
||||
def test_validate_configuration_format_with_missing_required_section_should_raise():
|
||||
parser = flexmock()
|
||||
parser.should_receive('sections').and_return(('section',))
|
||||
config_format = (
|
||||
module.Section_format(
|
||||
'section',
|
||||
options=(
|
||||
module.Config_option('stuff', str, required=True),
|
||||
),
|
||||
),
|
||||
# At least one option in this section is required, so the section is required.
|
||||
module.Section_format(
|
||||
'missing',
|
||||
options=(
|
||||
module.Config_option('such', str, required=False),
|
||||
module.Config_option('things', str, required=True),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
module.validate_configuration_format(parser, config_format)
|
||||
|
||||
|
||||
def test_validate_configuration_format_with_missing_optional_section_should_not_raise():
|
||||
parser = flexmock()
|
||||
parser.should_receive('sections').and_return(('section',))
|
||||
parser.should_receive('options').with_args('section').and_return(('stuff',))
|
||||
config_format = (
|
||||
module.Section_format(
|
||||
'section',
|
||||
options=(
|
||||
module.Config_option('stuff', str, required=True),
|
||||
),
|
||||
),
|
||||
# No options in the section are required, so the section is optional.
|
||||
module.Section_format(
|
||||
'missing',
|
||||
options=(
|
||||
module.Config_option('such', str, required=False),
|
||||
module.Config_option('things', str, required=False),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
module.validate_configuration_format(parser, config_format)
|
||||
|
||||
|
||||
def test_validate_configuration_format_with_unknown_section_should_raise():
|
||||
parser = flexmock()
|
||||
parser.should_receive('sections').and_return(('section', 'extra'))
|
||||
config_format = (
|
||||
module.Section_format('section', options=()),
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
module.validate_configuration_format(parser, config_format)
|
||||
|
||||
|
||||
def test_validate_configuration_format_with_missing_required_option_should_raise():
|
||||
parser = flexmock()
|
||||
parser.should_receive('sections').and_return(('section',))
|
||||
parser.should_receive('options').with_args('section').and_return(('option',))
|
||||
config_format = (
|
||||
module.Section_format(
|
||||
'section',
|
||||
options=(
|
||||
module.Config_option('option', str, required=True),
|
||||
module.Config_option('missing', str, required=True),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
module.validate_configuration_format(parser, config_format)
|
||||
|
||||
|
||||
def test_validate_configuration_format_with_missing_optional_option_should_not_raise():
|
||||
parser = flexmock()
|
||||
parser.should_receive('sections').and_return(('section',))
|
||||
parser.should_receive('options').with_args('section').and_return(('option',))
|
||||
config_format = (
|
||||
module.Section_format(
|
||||
'section',
|
||||
options=(
|
||||
module.Config_option('option', str, required=True),
|
||||
module.Config_option('missing', str, required=False),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
module.validate_configuration_format(parser, config_format)
|
||||
|
||||
|
||||
def test_validate_configuration_format_with_extra_option_should_raise():
|
||||
parser = flexmock()
|
||||
parser.should_receive('sections').and_return(('section',))
|
||||
parser.should_receive('options').with_args('section').and_return(('option', 'extra'))
|
||||
config_format = (
|
||||
module.Section_format(
|
||||
'section',
|
||||
options=(module.Config_option('option', str, required=True),),
|
||||
),
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
module.validate_configuration_format(parser, config_format)
|
||||
|
||||
|
||||
def test_parse_section_options_should_return_section_options():
|
||||
parser = flexmock()
|
||||
parser.should_receive('get').with_args('section', 'foo').and_return('value')
|
||||
parser.should_receive('getint').with_args('section', 'bar').and_return(1)
|
||||
parser.should_receive('getboolean').never()
|
||||
parser.should_receive('has_option').with_args('section', 'foo').and_return(True)
|
||||
parser.should_receive('has_option').with_args('section', 'bar').and_return(True)
|
||||
|
||||
section_format = module.Section_format(
|
||||
'section',
|
||||
(
|
||||
module.Config_option('foo', str, required=True),
|
||||
module.Config_option('bar', int, required=True),
|
||||
),
|
||||
)
|
||||
|
||||
config = module.parse_section_options(parser, section_format)
|
||||
|
||||
assert config == OrderedDict(
|
||||
(
|
||||
('foo', 'value'),
|
||||
('bar', 1),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_parse_section_options_for_missing_section_should_return_empty_dict():
|
||||
parser = flexmock()
|
||||
parser.should_receive('get').never()
|
||||
parser.should_receive('getint').never()
|
||||
parser.should_receive('getboolean').never()
|
||||
parser.should_receive('has_option').with_args('section', 'foo').and_return(False)
|
||||
parser.should_receive('has_option').with_args('section', 'bar').and_return(False)
|
||||
|
||||
section_format = module.Section_format(
|
||||
'section',
|
||||
(
|
||||
module.Config_option('foo', str, required=False),
|
||||
module.Config_option('bar', int, required=False),
|
||||
),
|
||||
)
|
||||
|
||||
config = module.parse_section_options(parser, section_format)
|
||||
|
||||
assert config == OrderedDict()
|
||||
|
||||
|
||||
def insert_mock_parser():
|
||||
parser = flexmock()
|
||||
parser.should_receive('read').and_return([flexmock()])
|
||||
module.RawConfigParser = lambda: parser
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def test_parse_configuration_should_return_section_configs():
|
||||
parser = insert_mock_parser()
|
||||
config_format = (flexmock(name='items'), flexmock(name='things'))
|
||||
mock_module = flexmock(module)
|
||||
mock_module.should_receive('validate_configuration_format').with_args(
|
||||
parser, config_format,
|
||||
).once()
|
||||
mock_section_configs = (flexmock(), flexmock())
|
||||
|
||||
for section_format, section_config in zip(config_format, mock_section_configs):
|
||||
mock_module.should_receive('parse_section_options').with_args(
|
||||
parser, section_format,
|
||||
).and_return(section_config).once()
|
||||
|
||||
parsed_config = module.parse_configuration('filename', config_format)
|
||||
|
||||
assert parsed_config == type(parsed_config)(*mock_section_configs)
|
||||
|
||||
|
||||
def test_parse_configuration_with_file_open_error_should_raise():
|
||||
parser = insert_mock_parser()
|
||||
parser.should_receive('read').and_return([])
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
module.parse_configuration('filename', config_format=flexmock())
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
from collections import OrderedDict
|
||||
from subprocess import STDOUT
|
||||
import sys
|
||||
import os
|
||||
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic import borg as module
|
||||
from borgmatic.tests.builtins import builtins_mock
|
||||
from borgmatic.verbosity import VERBOSITY_SOME, VERBOSITY_LOTS
|
||||
|
||||
|
||||
|
|
@ -389,7 +389,7 @@ def test_check_archives_should_call_borg_with_parameters():
|
|||
)
|
||||
insert_platform_mock()
|
||||
insert_datetime_mock()
|
||||
builtins_mock().should_receive('open').and_return(stdout)
|
||||
flexmock(sys.modules['builtins']).should_receive('open').and_return(stdout)
|
||||
flexmock(module.os).should_receive('devnull')
|
||||
|
||||
module.check_archives(
|
||||
|
|
@ -464,7 +464,7 @@ def test_check_archives_with_remote_path_should_call_borg_with_remote_path_param
|
|||
)
|
||||
insert_platform_mock()
|
||||
insert_datetime_mock()
|
||||
builtins_mock().should_receive('open').and_return(stdout)
|
||||
flexmock(sys.modules['builtins']).should_receive('open').and_return(stdout)
|
||||
flexmock(module.os).should_receive('devnull')
|
||||
|
||||
module.check_archives(
|
||||
|
|
|
|||
54
sample/config.yaml
Normal file
54
sample/config.yaml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
location:
|
||||
# List of source directories to backup. Globs are expanded.
|
||||
source_directories:
|
||||
- /home
|
||||
- /etc
|
||||
- /var/log/syslog*
|
||||
|
||||
# Stay in same file system (do not cross mount points).
|
||||
#one_file_system: yes
|
||||
|
||||
# Alternate Borg remote executable (defaults to "borg"):
|
||||
#remote_path: borg1
|
||||
|
||||
# Path to local or remote repository.
|
||||
repository: user@backupserver:sourcehostname.borg
|
||||
|
||||
#storage:
|
||||
# Passphrase to unlock the encryption key with. Only use on repositories
|
||||
# that were initialized with passphrase/repokey encryption.
|
||||
#encryption_passphrase: foo
|
||||
|
||||
# Type of compression to use when creating archives. See
|
||||
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-create
|
||||
# for details. Defaults to no compression.
|
||||
#compression: lz4
|
||||
|
||||
# Umask to be used for borg create.
|
||||
#umask: 0077
|
||||
|
||||
retention:
|
||||
# Retention policy for how many backups to keep in each category. See
|
||||
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-prune for
|
||||
# details.
|
||||
#keep_within: 3H
|
||||
#keep_hourly: 24
|
||||
keep_daily: 7
|
||||
keep_weekly: 4
|
||||
keep_monthly: 6
|
||||
keep_yearly: 1
|
||||
|
||||
# When pruning, only consider archive names starting with this prefix.
|
||||
#prefix: sourcehostname
|
||||
|
||||
consistency:
|
||||
# List of consistency checks to run: "repository", "archives", or both.
|
||||
# Defaults to both. Set to "disabled" to disable all consistency checks.
|
||||
# See https://borgbackup.readthedocs.org/en/stable/usage.html#borg-check
|
||||
# for details.
|
||||
checks:
|
||||
- repository
|
||||
- archives
|
||||
|
||||
# Restrict the number of checked archives to the last n.
|
||||
#check_last: 3
|
||||
10
setup.py
10
setup.py
|
|
@ -1,7 +1,7 @@
|
|||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
VERSION = '1.0.3-dev'
|
||||
VERSION = '1.1.0'
|
||||
|
||||
|
||||
setup(
|
||||
|
|
@ -30,8 +30,14 @@ setup(
|
|||
obsoletes=[
|
||||
'atticmatic',
|
||||
],
|
||||
install_requires=(
|
||||
'pykwalify',
|
||||
'ruamel.yaml<=0.15',
|
||||
'setuptools',
|
||||
),
|
||||
tests_require=(
|
||||
'flexmock',
|
||||
'pytest',
|
||||
)
|
||||
),
|
||||
include_package_data=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue