mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-13 10:50:21 -04: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
add7a22581
commit
41351af635
2 changed files with 22 additions and 1 deletions
|
|
@ -5314,7 +5314,7 @@ def main(): # pragma: no cover
|
|||
tb = f"{traceback.format_exc()}\n{sysinfo()}"
|
||||
exit_code = e.exit_code
|
||||
except RemoteRepository.RPCError as e:
|
||||
important = e.exception_class not in ('LockTimeout', ) and e.traceback
|
||||
important = e.traceback
|
||||
msgid = e.exception_class
|
||||
tb_log_level = logging.ERROR if important else logging.DEBUG
|
||||
if important:
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ from .helpers import sysinfo
|
|||
from .helpers import format_file_size
|
||||
from .helpers import safe_unlink
|
||||
from .helpers import prepare_subprocess_env, ignore_sigint
|
||||
from .locking import LockTimeout, NotLocked, NotMyLock, LockFailed
|
||||
from .logger import create_logger, setup_logging
|
||||
from .helpers import msgpack
|
||||
from .repository import Repository
|
||||
|
|
@ -779,6 +780,26 @@ This problem will go away as soon as the server has been upgraded to 1.0.7+.
|
|||
raise InvalidRPCMethod('(not available)')
|
||||
else:
|
||||
raise InvalidRPCMethod(args[0].decode())
|
||||
elif error == 'LockTimeout':
|
||||
if old_server:
|
||||
raise LockTimeout('(not available)')
|
||||
else:
|
||||
raise LockTimeout(args[0].decode())
|
||||
elif error == 'LockFailed':
|
||||
if old_server:
|
||||
raise LockFailed('(not available)', '')
|
||||
else:
|
||||
raise LockFailed(args[0].decode(), args[1].decode())
|
||||
elif error == 'NotLocked':
|
||||
if old_server:
|
||||
raise NotLocked('(not available)')
|
||||
else:
|
||||
raise NotLocked(args[0].decode())
|
||||
elif error == 'NotMyLock':
|
||||
if old_server:
|
||||
raise NotMyLock('(not available)')
|
||||
else:
|
||||
raise NotMyLock(args[0].decode())
|
||||
else:
|
||||
raise self.RPCError(unpacked)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue