mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-10 17:32:13 -04:00
Let ssh figure out port/user if not specified so we don't override .ssh/config
Modified by Jonas Borgström: - Added CHANGES entry - Fixed broken unit test
This commit is contained in:
parent
a579b7917b
commit
29d184dfcb
4 changed files with 17 additions and 5 deletions
7
CHANGES
7
CHANGES
|
|
@ -3,6 +3,13 @@ Attic Changelog
|
|||
|
||||
Here you can see the full list of changes between each Attic release.
|
||||
|
||||
Version 0.9
|
||||
-----------
|
||||
|
||||
(feature release, released on X)
|
||||
|
||||
- Let ssh figure out port/user if not specified so we don't override .ssh/config (#9)
|
||||
|
||||
Version 0.8.1
|
||||
-------------
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ class Location:
|
|||
self.proto = m.group('proto')
|
||||
self.user = m.group('user')
|
||||
self.host = m.group('host')
|
||||
self.port = m.group('port') and int(m.group('port')) or 22
|
||||
self.port = m.group('port') and int(m.group('port')) or None
|
||||
self.path = m.group('path')
|
||||
self.archive = m.group('archive')
|
||||
return True
|
||||
|
|
@ -302,8 +302,6 @@ class Location:
|
|||
self.path = m.group('path')
|
||||
self.archive = m.group('archive')
|
||||
self.proto = self.host and 'ssh' or 'file'
|
||||
if self.proto == 'ssh':
|
||||
self.port = 22
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,14 @@ class RemoteRepository(object):
|
|||
if location.host == '__testsuite__':
|
||||
args = [sys.executable, '-m', 'attic.archiver', 'serve']
|
||||
else:
|
||||
args = ['ssh', '-p', str(location.port), '%s@%s' % (location.user or getpass.getuser(), location.host), 'attic', 'serve']
|
||||
args = ['ssh',]
|
||||
if location.port:
|
||||
args += ['-p', str(location.port)]
|
||||
if location.user:
|
||||
args.append('%s@%s' % (location.user, location.host))
|
||||
else:
|
||||
args.append('%s' % location.host)
|
||||
args += ['attic', 'serve']
|
||||
self.p = Popen(args, bufsize=0, stdin=PIPE, stdout=PIPE)
|
||||
self.stdin_fd = self.p.stdin.fileno()
|
||||
self.stdout_fd = self.p.stdout.fileno()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class LocationTestCase(AtticTestCase):
|
|||
)
|
||||
self.assert_equal(
|
||||
repr(Location('user@host:/some/path::archive')),
|
||||
"Location(proto='ssh', user='user', host='host', port=22, path='/some/path', archive='archive')"
|
||||
"Location(proto='ssh', user='user', host='host', port=None, path='/some/path', archive='archive')"
|
||||
)
|
||||
self.assert_equal(
|
||||
repr(Location('mybackup.attic::archive')),
|
||||
|
|
|
|||
Loading…
Reference in a new issue