1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00

remote: introduce a dontcare flag (all values acceptable)

in some cases the value of a new parameter does not really matter,
as long as it works / there is no malfunction.

without this change, a new borg client could not commit to an old
borg server (and would fail late when trying to commit):

- when using compact=False as it does at most places

- when using cleanup_commits=True as a user might trigger by running
  borg compact --cleanup-commits

we never want a borg commit "fail late", leaving the repo in a state
with uncommitted data, thus the server shall just commit, no matter
how it handles compaction or whether it can do the cleanup.
This commit is contained in:
Thomas Waldmann 2018-07-11 05:19:08 +02:00
parent 3715d2da3e
commit a221ca16ad

View file

@ -462,6 +462,8 @@ def do_rpc(self, *args, **kwargs):
continue continue
if 'previously' in restriction and named[name] == restriction['previously']: if 'previously' in restriction and named[name] == restriction['previously']:
continue continue
if restriction.get('dontcare', False):
continue
raise self.RPCServerOutdated("{0} {1}={2!s}".format(f.__name__, name, named[name]), raise self.RPCServerOutdated("{0} {1}={2!s}".format(f.__name__, name, named[name]),
format_version(restriction['since'])) format_version(restriction['since']))
@ -890,8 +892,8 @@ def check(self, repair=False, save_space=False):
"""actual remoting is done via self.call in the @api decorator""" """actual remoting is done via self.call in the @api decorator"""
@api(since=parse_version('1.0.0'), @api(since=parse_version('1.0.0'),
compact={'since': parse_version('1.2.0a0'), 'previously': True}, compact={'since': parse_version('1.2.0a0'), 'previously': True, 'dontcare': True},
cleanup_commits={'since': parse_version('1.2.0a0'), 'previously': False}) cleanup_commits={'since': parse_version('1.2.0a0'), 'previously': False, 'dontcare': True})
def commit(self, save_space=False, compact=True, cleanup_commits=False): def commit(self, save_space=False, compact=True, cleanup_commits=False):
"""actual remoting is done via self.call in the @api decorator""" """actual remoting is done via self.call in the @api decorator"""