Commit graph

61 commits

Author SHA1 Message Date
Thomas Waldmann
fc92822b6c explain the confusing TypeError, fixes #1456 2016-08-09 17:35:27 +02:00
Thomas Waldmann
33e3348208 locking: better differentiate new vs. old clients, lock upgrade for replay
old clients use self.exclusive = None and do a read->write lock upgrade when needed.
new clients use self.exclusive = True/False and never upgrade.

replay fakes an old client by setting self.exclusive = None to get a lock upgrade if needed.
2016-08-05 19:11:16 +02:00
Thomas Waldmann
64dcbbfdd0 change RPC API, fix remote repo tests 2016-08-05 19:11:16 +02:00
TW
3456bb08a5 Merge pull request #1423 from leo-b/1.0-maint-version_placeholder
borgversion placeholder 1.0-maint
2016-08-02 18:43:45 +02:00
Alexander 'Leo' Bergolth
54048a339c add new placeholder {borgversion}
substitute placeholders in --remote-path
add BORG_VERSION environment variable before executing ssh command
2016-08-02 17:03:13 +02:00
Thomas Waldmann
5a83f74418 RemoteRepository init: always call close on exceptions, fixes #1370
This fixes the cosmetic issue that the cleanup happened in __del__ and caused an AssertionError there.
2016-07-30 19:42:25 +02:00
Lee Bousfield
88a4989c57 Add --append-only to borg init 2016-07-27 08:52:42 -04:00
Thomas Waldmann
3325126988 add missing BORG_REMOTE_PATH env var, fixes #1258 2016-07-04 15:06:20 +02:00
Thomas Waldmann
9725c03299 close the repo on exit - even if rollback did not work, fixes #1197 2016-07-03 02:58:17 +02:00
Lee Bousfield
c515d6018d
Add --append-only to borg serve
Fixes #1168
2016-06-30 17:58:36 -04:00
Marian Beermann
e96905c6b1
Fix error swallowing of ignored responses in RPC code 2016-06-27 22:45:44 +02:00
Thomas Waldmann
ca35d9f255 remove passphrase from subprocess environment, fixes #1105 2016-06-05 00:25:30 +02:00
Marian Beermann
f7f95ae731
RepositoryCache: don't cache large objects
avoids excessive cache repository disk usage
2016-05-20 02:01:17 +02:00
TW
9a7bad295c Merge pull request #838 from enkore/issue/792
Remote: don't print tracebacks for Error exceptions handled downstream
2016-04-04 21:37:04 +02:00
Marian Beermann
890e44ef60 RemoteRepository: clean up pipe if remote open() fails 2016-04-04 17:10:14 +02:00
Marian Beermann
425a4d819d Remote: don't print tracebacks for Error exceptions handled downstream
(What we'd really want is to have proper exception transporting over
 the RPC)

Fixes #792
2016-04-04 17:09:52 +02:00
TW
a519333376 add --warning, --error, --critical for completeness, fixes #826
it's not recommended to suppress warnings or errors,
but the user may decide this on his own.

note: --warning is not given to borg serve so a <= 1.0.0 borg
will still work as server. it is not needed as it is the default.
2016-04-03 20:20:48 +02:00
Marian Beermann
83586ae09c Make Repository a context manager, use decorators for wrapping withs
(Remote)Repository.close() is not a public API anymore, but a private
API. It shall not be used from within other classes than Repository
or it's tests. The proper way is to use a context manager now. However,
for RPC/Remote compatibility with Borg 1.0 it is kept and unchanged.

Repositories are not opened by __init__ now anymore, it is done
by binding it to a context manager. (This SHOULD be compatible both ways
with remote, since opening the repo is handled by a RepositoryServer method)

Decorators @with_repository() and @with_archive simplify
context manager handling and remove unnecessary indentation.

Backported to 1.0-maint
2016-04-03 17:14:43 +02:00
Thomas Waldmann
4b339f5d69 cosmetic source cleanup (flake8) 2016-01-30 21:32:45 +01:00
Thomas Waldmann
7773e632db fix some minor cosmetic code/docs issues 2016-01-30 00:01:13 +01:00
Thomas Waldmann
6d615ec30a change encryption to be on by default (repokey mode)
it's 2015, let's be safe-by-default and unsafe-as-option.

also: show default mode in builtin help
2016-01-24 15:44:09 +01:00
Thomas Waldmann
fc52101d46 suppress unneeded exception context (PEP 409) 2016-01-24 15:36:04 +01:00
Thomas Waldmann
4444113414 remove misc. compat code not needed for py 3.4+ 2016-01-24 15:16:05 +01:00
Thomas Waldmann
4d73f3cdb9 implement and use context manager for RepositoryCache, fixes #548 2016-01-17 00:30:00 +01:00
Thomas Waldmann
e68b800d01 remove unused "repair" rpc method
there is no such method in the code.
we use "check" method to repair the repo, so maybe this was left over
from a time when repair was separate from check.
2016-01-16 18:58:52 +01:00
Thomas Waldmann
170f847e74 unset LD_LIBRARY_PATH before invoking ssh, hopefully fixes #514 2016-01-11 02:08:58 +01:00
Thomas Waldmann
0c166898bf fix python 3.2 str.splitlines() compatibility issue 2015-12-13 00:51:39 +01:00
Thomas Waldmann
942120997e log remote exceptions, add remote sysinfo 2015-12-12 22:45:29 +01:00
Thomas Waldmann
2df0bb1f83 remote stderr: keep line endings as is
so even the \r trick works for overwriting the same line.
2015-12-12 22:15:08 +01:00
Thomas Waldmann
2e2e145372 sane remote logging, remote stderr, fixes #461 2015-12-12 22:15:08 +01:00
Thomas Waldmann
229512b6f5 determine log level from the logger, so it works with logging.conf also 2015-12-12 22:15:08 +01:00
Thomas Waldmann
eab60cce99 pass through some global options from client to server
new: logging level options
refactored:
- umask option and remote_path
- cleanly separated ssh command from borg command
2015-12-12 22:15:08 +01:00
Thomas Waldmann
0c076ad114 compact_segments: save_space -> free unused segments quickly
as soon as one target segment is full, it is a good time to commit it and remove the source segments
that are already completely unused (because they were transferred int the target segment).

so, for compact_segments(save_space=True), the additional space needed should be about 1 segment size.

note: we can't just do that at the end of one source segment as this might create very small
target segments, which is not wanted.
2015-12-08 18:36:41 +01:00
Thomas Waldmann
6d083c0695 increase rpc protocol version to 2
this is needed because due to the locking improvements, some rpc calls' signature changed slightly.
2015-12-03 17:50:37 +01:00
Thomas Waldmann
38994c78fc implement borg break-lock REPO command, fixes #157
due to borg's architecture, breaking the repo lock needs first creating a repository object.
this would usually try to get a lock and then block if there already is one.
thus I added a flag to open without trying to create a lock.
2015-11-21 20:50:53 +01:00
Thomas Waldmann
f19e95fcf7 implement --lock-wait, support timeout for UpgradableLock, fixes #210
also: simplify exceptions / exception handling
2015-11-21 15:34:51 +01:00
Antoine Beaupré
f13dd6e579 completely remove have_cython() hack
this was making us require mock, which is really a test component and
shouldn't be part of the runtime dependencies. furthermore, it was
making the imports and the code more brittle: it may have been
possible that, through an environment variable, backups could be
corrupted because mock libraries would be configured instead of real
once, which is a risk we shouldn't be taking.

finally, this was used only to build docs, which we will build and
commit to git by hand with a fully working borg when relevant.

see #384.
2015-11-13 10:40:53 -05:00
TW
f651b014e6 Merge pull request #350 from ThomasWaldmann/fix-307
prettier connection closed message, fixes #307
2015-10-31 23:19:26 +01:00
Thomas Waldmann
1740384763 prettier connection closed message, fixes #307 2015-10-31 22:41:08 +01:00
Thomas Waldmann
762fdaadd8 prettier error messages, fixes #57
subclasses of "Error": do not show traceback
(this is used when a failure is expected and has rather trivial reasons and usually
does not need debugging)

subclasses of "ErrorWithTraceback": show a traceback
(this is for severe and rather unexpected stuff, like consistency / corruption issues
or stuff that might need debugging)

I reviewed all the Error subclasses whether they fit into the one or other class.

Also: fixed docstring typo, docstring formatting
2015-10-31 22:23:32 +01:00
Antoine Beaupré
80e53fb66d it's a function, call it as such 2015-10-08 17:16:11 -04:00
Antoine Beaupré
a869ab0702 try to fix RTD build *again* *again* 2015-10-08 17:03:35 -04:00
Thomas Waldmann
a4967ec582 ssh_cmd: fix wrong caller, fixes #255 2015-10-07 03:32:55 +02:00
Antoine Beaupré
a7b70d87cd complete test coverage for SSH args parsing 2015-10-05 19:22:33 -04:00
Antoine Beaupré
a0ef4e25dd add support for arbitrary SSH commands (attic#99)
while SSH options can be specified through `~/.ssh/config`, some users
may want to use a completely different SSH command for their backups,
without overriding their $PATH variable. it may also be easier to do
ad-hoc configuration and tests that way.

plus, the POLA tells us that users expects something like this to be
supported by commands that talk to ssh. it is supported by rsync, git
and so on.
2015-10-05 18:54:00 -04:00
Antoine Beaupré
43a65933f7 move ssh generation code to a stub, add unit test 2015-10-05 18:51:20 -04:00
Antoine Beaupré
de2a811606 move RemoteRepository defaults to the class
the reasoning behind this is that we may need to test a
RemoteRepository setup outside of the main archiver routines, which
the current default location makes impossible

by moving the umask and remote_path remotes into the RemoteRepository
the (reasonable) defaults are available regardless of the (currently
obscure) initialisation routine, and make unit tests easier to develop
and support
2015-10-05 18:45:57 -04:00
Thomas Waldmann
8300efb1db remote: pragma: no cover for the stuff we can't test 2015-08-12 04:28:31 +02:00
Thomas Waldmann
175a6d7b04 simplify umask code
in a similar way as the remote_path code was implemented:
just patch the RemoteRepository class object
2015-08-04 12:31:06 +02:00
Thomas Waldmann
71646249cb implement --remote-path to allow non-default-path borg locations 2015-08-04 09:53:26 +02:00