1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-01 12:45:34 +00:00

fix dealing with remote repo Locking Exceptions

previously, this was handled in RPCError handler and always resulted in rc 2.

now re-raise Lock Exceptions locally, so it gives rc 2 (legacy) or 7x (modern).
This commit is contained in:
Thomas Waldmann 2023-11-12 21:09:08 +01:00
parent cb8b718a96
commit 0504dee0d9
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 10 additions and 1 deletions

View file

@ -644,7 +644,7 @@ def main(): # pragma: no cover
tb = format_tb(e)
exit_code = e.exit_code
except RemoteRepository.RPCError as e:
important = e.exception_class not in ("LockTimeout",) and e.traceback
important = e.traceback
msg = e.exception_full if important else e.get_message()
msgid = e.exception_class
tb_log_level = logging.ERROR if important else logging.DEBUG

View file

@ -30,6 +30,7 @@
from .helpers import safe_unlink
from .helpers import prepare_subprocess_env, ignore_sigint
from .helpers import get_socket_filename
from .locking import LockTimeout, NotLocked, NotMyLock, LockFailed
from .logger import create_logger, borg_serve_log_queue
from .helpers import msgpack
from .repository import Repository
@ -781,6 +782,14 @@ def handle_error(unpacked):
raise Repository.ObjectNotFound(args[0], self.location.processed)
elif error == "InvalidRPCMethod":
raise InvalidRPCMethod(args[0])
elif error == "LockTimeout":
raise LockTimeout(args[0])
elif error == "LockFailed":
raise LockFailed(args[0], args[1])
elif error == "NotLocked":
raise NotLocked(args[0])
elif error == "NotMyLock":
raise NotMyLock(args[0])
else:
raise self.RPCError(unpacked)