serve: ignore --append-only when creating a repository (#2501)

This commit is contained in:
enkore 2017-05-12 20:34:45 +02:00 committed by GitHub
parent 6cd7d415ca
commit 9e6b8f67b9
3 changed files with 15 additions and 5 deletions

View File

@ -136,6 +136,9 @@ Compatibility notes:
- Repositories in a repokey mode with a blank passphrase are now treated
as unencrypted repositories for security checks
(e.g. BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK).
- Running "borg init" via a "borg serve --append-only" server will *not* create
an append-only repository anymore. Use "borg init --append-only" to initialize
an append-only repository.
Version 1.1.0b5 (2017-04-30)
----------------------------

View File

@ -677,10 +677,9 @@ in ``.ssh/authorized_keys`` ::
command="borg serve --append-only ..." ssh-rsa <key used for not-always-trustable backup clients>
command="borg serve ..." ssh-rsa <key used for backup management>
Please note that if you run ``borg init`` via a ``borg serve --append-only``
server, the repository config will be created with a ``append_only=1`` entry.
This behaviour is subject to change in a later borg version. So, be aware of
it for now, but do not rely on it.
Running ``borg init`` via a ``borg serve --append-only`` server will *not* create
an append-only repository. Running ``borg init --append-only`` creates an append-only
repository regardless of server settings.
Example
+++++++

View File

@ -180,6 +180,10 @@ class RepositoryServer: # pragma: no cover
def __init__(self, restrict_to_paths, append_only):
self.repository = None
self.restrict_to_paths = restrict_to_paths
# This flag is parsed from the serve command line via Archiver.do_serve,
# i.e. it reflects local system policy and generally ranks higher than
# whatever the client wants, except when initializing a new repository
# (see RepositoryServer.open below).
self.append_only = append_only
self.client_version = parse_version('1.0.8') # fallback version if client is too old to send version information
@ -345,8 +349,12 @@ class RepositoryServer: # pragma: no cover
break
else:
raise PathNotAllowed(path)
# "borg init" on "borg serve --append-only" (=self.append_only) does not create an append only repo,
# while "borg init --append-only" (=append_only) does, regardless of the --append-only (self.append_only)
# flag for serve.
append_only = (not create and self.append_only) or append_only
self.repository = Repository(path, create, lock_wait=lock_wait, lock=lock,
append_only=self.append_only or append_only,
append_only=append_only,
exclusive=exclusive)
self.repository.__enter__() # clean exit handled by serve() method
return self.repository.id