mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-04 06:21:46 +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:
parent
cb8b718a96
commit
0504dee0d9
2 changed files with 10 additions and 1 deletions
|
@ -644,7 +644,7 @@ def main(): # pragma: no cover
|
||||||
tb = format_tb(e)
|
tb = format_tb(e)
|
||||||
exit_code = e.exit_code
|
exit_code = e.exit_code
|
||||||
except RemoteRepository.RPCError as e:
|
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()
|
msg = e.exception_full if important else e.get_message()
|
||||||
msgid = e.exception_class
|
msgid = e.exception_class
|
||||||
tb_log_level = logging.ERROR if important else logging.DEBUG
|
tb_log_level = logging.ERROR if important else logging.DEBUG
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
from .helpers import safe_unlink
|
from .helpers import safe_unlink
|
||||||
from .helpers import prepare_subprocess_env, ignore_sigint
|
from .helpers import prepare_subprocess_env, ignore_sigint
|
||||||
from .helpers import get_socket_filename
|
from .helpers import get_socket_filename
|
||||||
|
from .locking import LockTimeout, NotLocked, NotMyLock, LockFailed
|
||||||
from .logger import create_logger, borg_serve_log_queue
|
from .logger import create_logger, borg_serve_log_queue
|
||||||
from .helpers import msgpack
|
from .helpers import msgpack
|
||||||
from .repository import Repository
|
from .repository import Repository
|
||||||
|
@ -781,6 +782,14 @@ def handle_error(unpacked):
|
||||||
raise Repository.ObjectNotFound(args[0], self.location.processed)
|
raise Repository.ObjectNotFound(args[0], self.location.processed)
|
||||||
elif error == "InvalidRPCMethod":
|
elif error == "InvalidRPCMethod":
|
||||||
raise InvalidRPCMethod(args[0])
|
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:
|
else:
|
||||||
raise self.RPCError(unpacked)
|
raise self.RPCError(unpacked)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue