forked from borgmatic-collective/borgmatic
Add an encryption option to repositories (#303).
This commit is contained in:
4
NEWS
4
NEWS
@@ -2,6 +2,10 @@
|
||||
* #303: Add flags for setting any borgmatic configuration option from the command-line. See the
|
||||
documentation for more information:
|
||||
https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#configuration-overrides
|
||||
* #303: Add configuration options that serve as defaults for some (but not all) borgmatic
|
||||
action flags. For example, each entry in "repositories:" now has an "encryption" option that
|
||||
applies to the "repo-create" action. See the documentation for more information:
|
||||
https://torsion.org/borgmatic/docs/reference/configuration/
|
||||
* #790, #821: Deprecate all "before_*", "after_*" and "on_error" command hooks in favor of more
|
||||
flexible "commands:". See the documentation for more information:
|
||||
https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/
|
||||
|
||||
@@ -24,13 +24,21 @@ def run_repo_create(
|
||||
return
|
||||
|
||||
logger.info('Creating repository')
|
||||
|
||||
encryption_mode = repo_create_arguments.encryption_mode or repository.get('encryption')
|
||||
|
||||
if not encryption_mode:
|
||||
raise ValueError(
|
||||
'With the repo-create action, either the --encryption flag or the repository encryption option is required.'
|
||||
)
|
||||
|
||||
borgmatic.borg.repo_create.create_repository(
|
||||
global_arguments.dry_run,
|
||||
repository['path'],
|
||||
config,
|
||||
local_borg_version,
|
||||
global_arguments,
|
||||
repo_create_arguments.encryption_mode,
|
||||
encryption_mode,
|
||||
repo_create_arguments.source_repository,
|
||||
repo_create_arguments.copy_crypt_key,
|
||||
repo_create_arguments.append_only,
|
||||
|
||||
@@ -445,7 +445,10 @@ def make_parsers(schema, unparsed_arguments):
|
||||
config_paths = collect.get_default_config_paths(expand_home=True)
|
||||
unexpanded_config_paths = collect.get_default_config_paths(expand_home=False)
|
||||
|
||||
global_parser = ArgumentParser(add_help=False)
|
||||
# allow_abbrev=False prevents the global parser from erroring about "ambiguous" options like
|
||||
# --encryption. Such options are intended for an action parser rather than the global parser,
|
||||
# and so we don't want to error on them here.
|
||||
global_parser = ArgumentParser(allow_abbrev=False, add_help=False)
|
||||
global_group = global_parser.add_argument_group('global arguments')
|
||||
|
||||
global_group.add_argument(
|
||||
@@ -569,7 +572,6 @@ def make_parsers(schema, unparsed_arguments):
|
||||
'--encryption',
|
||||
dest='encryption_mode',
|
||||
help='Borg repository encryption mode',
|
||||
required=True,
|
||||
)
|
||||
repo_create_group.add_argument(
|
||||
'--source-repository',
|
||||
|
||||
@@ -45,6 +45,14 @@ properties:
|
||||
and to make selecting the repository easier on the
|
||||
command-line.
|
||||
example: backupserver
|
||||
encryption:
|
||||
type: string
|
||||
description: |
|
||||
The encryption mode with which to create the repository,
|
||||
only used for the repo-create action. To see the
|
||||
available encryption modes, run "borg init --help" with
|
||||
Borg 1 or "borg repo-create --help" with Borg 2.
|
||||
example: repokey-blake2
|
||||
description: |
|
||||
A required list of local or remote repositories with paths and
|
||||
optional labels (which can be used with the --repository flag to
|
||||
|
||||
Reference in New Issue
Block a user