|
@@ -12,52 +12,143 @@ def normalize(config_filename, config):
|
|
location = config.get('location') or {}
|
|
location = config.get('location') or {}
|
|
storage = config.get('storage') or {}
|
|
storage = config.get('storage') or {}
|
|
consistency = config.get('consistency') or {}
|
|
consistency = config.get('consistency') or {}
|
|
|
|
+ retention = config.get('retention') or {}
|
|
hooks = config.get('hooks') or {}
|
|
hooks = config.get('hooks') or {}
|
|
|
|
|
|
# Upgrade exclude_if_present from a string to a list.
|
|
# Upgrade exclude_if_present from a string to a list.
|
|
exclude_if_present = location.get('exclude_if_present')
|
|
exclude_if_present = location.get('exclude_if_present')
|
|
if isinstance(exclude_if_present, str):
|
|
if isinstance(exclude_if_present, str):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The exclude_if_present option now expects a list value. String values for this option are deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['location']['exclude_if_present'] = [exclude_if_present]
|
|
config['location']['exclude_if_present'] = [exclude_if_present]
|
|
|
|
|
|
# Upgrade various monitoring hooks from a string to a dict.
|
|
# Upgrade various monitoring hooks from a string to a dict.
|
|
healthchecks = hooks.get('healthchecks')
|
|
healthchecks = hooks.get('healthchecks')
|
|
if isinstance(healthchecks, str):
|
|
if isinstance(healthchecks, str):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The healthchecks hook now expects a mapping value. String values for this option are deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['hooks']['healthchecks'] = {'ping_url': healthchecks}
|
|
config['hooks']['healthchecks'] = {'ping_url': healthchecks}
|
|
|
|
|
|
cronitor = hooks.get('cronitor')
|
|
cronitor = hooks.get('cronitor')
|
|
if isinstance(cronitor, str):
|
|
if isinstance(cronitor, str):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The healthchecks hook now expects key/value pairs. String values for this option are deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['hooks']['cronitor'] = {'ping_url': cronitor}
|
|
config['hooks']['cronitor'] = {'ping_url': cronitor}
|
|
|
|
|
|
pagerduty = hooks.get('pagerduty')
|
|
pagerduty = hooks.get('pagerduty')
|
|
if isinstance(pagerduty, str):
|
|
if isinstance(pagerduty, str):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The healthchecks hook now expects key/value pairs. String values for this option are deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['hooks']['pagerduty'] = {'integration_key': pagerduty}
|
|
config['hooks']['pagerduty'] = {'integration_key': pagerduty}
|
|
|
|
|
|
cronhub = hooks.get('cronhub')
|
|
cronhub = hooks.get('cronhub')
|
|
if isinstance(cronhub, str):
|
|
if isinstance(cronhub, str):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The healthchecks hook now expects key/value pairs. String values for this option are deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['hooks']['cronhub'] = {'ping_url': cronhub}
|
|
config['hooks']['cronhub'] = {'ping_url': cronhub}
|
|
|
|
|
|
# Upgrade consistency checks from a list of strings to a list of dicts.
|
|
# Upgrade consistency checks from a list of strings to a list of dicts.
|
|
checks = consistency.get('checks')
|
|
checks = consistency.get('checks')
|
|
if isinstance(checks, list) and len(checks) and isinstance(checks[0], str):
|
|
if isinstance(checks, list) and len(checks) and isinstance(checks[0], str):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The checks option now expects a list of key/value pairs. Lists of strings for this option are deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['consistency']['checks'] = [{'name': check_type} for check_type in checks]
|
|
config['consistency']['checks'] = [{'name': check_type} for check_type in checks]
|
|
|
|
|
|
# Rename various configuration options.
|
|
# Rename various configuration options.
|
|
numeric_owner = location.pop('numeric_owner', None)
|
|
numeric_owner = location.pop('numeric_owner', None)
|
|
if numeric_owner is not None:
|
|
if numeric_owner is not None:
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The numeric_owner option has been renamed to numeric_ids. numeric_owner is deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['location']['numeric_ids'] = numeric_owner
|
|
config['location']['numeric_ids'] = numeric_owner
|
|
|
|
|
|
bsd_flags = location.pop('bsd_flags', None)
|
|
bsd_flags = location.pop('bsd_flags', None)
|
|
if bsd_flags is not None:
|
|
if bsd_flags is not None:
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The bsd_flags option has been renamed to flags. bsd_flags is deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['location']['flags'] = bsd_flags
|
|
config['location']['flags'] = bsd_flags
|
|
|
|
|
|
remote_rate_limit = storage.pop('remote_rate_limit', None)
|
|
remote_rate_limit = storage.pop('remote_rate_limit', None)
|
|
if remote_rate_limit is not None:
|
|
if remote_rate_limit is not None:
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The remote_rate_limit option has been renamed to upload_rate_limit. remote_rate_limit is deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['storage']['upload_rate_limit'] = remote_rate_limit
|
|
config['storage']['upload_rate_limit'] = remote_rate_limit
|
|
|
|
|
|
# Upgrade remote repositories to ssh:// syntax, required in Borg 2.
|
|
# Upgrade remote repositories to ssh:// syntax, required in Borg 2.
|
|
repositories = location.get('repositories')
|
|
repositories = location.get('repositories')
|
|
if repositories:
|
|
if repositories:
|
|
if isinstance(repositories[0], str):
|
|
if isinstance(repositories[0], str):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The repositories option now expects a list of key/value pairs. Lists of strings for this option are deprecated and support will be removed from a future release.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
config['location']['repositories'] = [
|
|
config['location']['repositories'] = [
|
|
{'path': repository} for repository in repositories
|
|
{'path': repository} for repository in repositories
|
|
]
|
|
]
|
|
@@ -71,7 +162,7 @@ def normalize(config_filename, config):
|
|
dict(
|
|
dict(
|
|
levelno=logging.WARNING,
|
|
levelno=logging.WARNING,
|
|
levelname='WARNING',
|
|
levelname='WARNING',
|
|
- msg=f'{config_filename}: Repository paths containing "~" are deprecated in borgmatic and no longer work in Borg 2.x+.',
|
|
|
|
|
|
+ msg=f'{config_filename}: Repository paths containing "~" are deprecated in borgmatic and support will be removed from a future release.',
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
@@ -95,7 +186,7 @@ def normalize(config_filename, config):
|
|
dict(
|
|
dict(
|
|
levelno=logging.WARNING,
|
|
levelno=logging.WARNING,
|
|
levelname='WARNING',
|
|
levelname='WARNING',
|
|
- msg=f'{config_filename}: Remote repository paths without ssh:// syntax are deprecated. Interpreting "{repository_path}" as "{rewritten_repository_path}"',
|
|
|
|
|
|
+ msg=f'{config_filename}: Remote repository paths without ssh:// syntax are deprecated and support will be removed from a future release. Interpreting "{repository_path}" as "{rewritten_repository_path}"',
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
@@ -108,4 +199,15 @@ def normalize(config_filename, config):
|
|
else:
|
|
else:
|
|
config['location']['repositories'].append(repository_dict)
|
|
config['location']['repositories'].append(repository_dict)
|
|
|
|
|
|
|
|
+ if consistency.get('prefix') or retention.get('prefix'):
|
|
|
|
+ logs.append(
|
|
|
|
+ logging.makeLogRecord(
|
|
|
|
+ dict(
|
|
|
|
+ levelno=logging.WARNING,
|
|
|
|
+ levelname='WARNING',
|
|
|
|
+ msg=f'{config_filename}: The prefix option is deprecated and support will be removed from a future release. Use archive_name_format or match_archives instead.',
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+
|
|
return logs
|
|
return logs
|