mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 00:07:38 +00:00
do not show archive name in error msgs referring to repository (#6023)
do not show archive name in repo error msgs, fix #6014
This commit is contained in:
parent
450ab38e42
commit
fec3568cba
3 changed files with 13 additions and 1 deletions
|
@ -158,7 +158,7 @@ def wrapper(self, args, **kwargs):
|
|||
if argument(args, fake) ^ invert_fake:
|
||||
return method(self, args, repository=None, **kwargs)
|
||||
elif location.proto == 'ssh':
|
||||
repository = RemoteRepository(location, create=create, exclusive=argument(args, exclusive),
|
||||
repository = RemoteRepository(location.omit_archive(), create=create, exclusive=argument(args, exclusive),
|
||||
lock_wait=self.lock_wait, lock=lock, append_only=append_only,
|
||||
make_parent_dirs=make_parent_dirs, args=args)
|
||||
else:
|
||||
|
|
|
@ -492,6 +492,12 @@ def with_timestamp(self, timestamp):
|
|||
'utcnow': DatetimeWrapper(timestamp),
|
||||
})
|
||||
|
||||
def omit_archive(self):
|
||||
loc = Location(self.orig)
|
||||
loc.archive = None
|
||||
loc.orig = loc.orig.split("::")[0]
|
||||
return loc
|
||||
|
||||
|
||||
def location_validator(archive=None, proto=None):
|
||||
def validator(text):
|
||||
|
|
|
@ -234,6 +234,12 @@ def test_bad_syntax(self):
|
|||
# this is invalid due to the 2nd colon, correct: 'ssh://user@host/path'
|
||||
Location('ssh://user@host:/path')
|
||||
|
||||
def test_omit_archive(self):
|
||||
loc = Location('ssh://user@host:1234/some/path::archive')
|
||||
loc_without_archive = loc.omit_archive()
|
||||
assert loc_without_archive.archive is None
|
||||
assert loc_without_archive.orig == "ssh://user@host:1234/some/path"
|
||||
|
||||
|
||||
class TestLocationWithEnv:
|
||||
def test_ssh(self, monkeypatch):
|
||||
|
|
Loading…
Reference in a new issue