When validating configuration files, require strings instead of allowing any scalar type.

This commit is contained in:
Dan Helfman 2019-08-03 14:52:12 -07:00
parent 9ec75ccf3f
commit a7cc2ea803
2 changed files with 31 additions and 28 deletions

3
NEWS
View File

@ -1,3 +1,6 @@
1.3.14
* When validating configuration files, require strings instead of allowing any scalar type.
1.3.13 1.3.13
* #199: Add note to documentation about using spaces instead of tabs for indentation, as YAML does * #199: Add note to documentation about using spaces instead of tabs for indentation, as YAML does
not allow tabs. not allow tabs.

View File

@ -11,7 +11,7 @@ map:
source_directories: source_directories:
required: true required: true
seq: seq:
- type: scalar - type: str
desc: | desc: |
List of source directories to backup (required). Globs and tildes are expanded. List of source directories to backup (required). Globs and tildes are expanded.
example: example:
@ -21,7 +21,7 @@ map:
repositories: repositories:
required: true required: true
seq: seq:
- type: scalar - type: str
desc: | desc: |
Paths to local or remote repositories (required). Tildes are expanded. Multiple Paths to local or remote repositories (required). Tildes are expanded. Multiple
repositories are backed up to in sequence. See ssh_command for SSH options like repositories are backed up to in sequence. See ssh_command for SSH options like
@ -60,23 +60,23 @@ map:
desc: Record bsdflags (e.g. NODUMP, IMMUTABLE) in archive. Defaults to true. desc: Record bsdflags (e.g. NODUMP, IMMUTABLE) in archive. Defaults to true.
example: true example: true
files_cache: files_cache:
type: scalar type: str
desc: | desc: |
Mode in which to operate the files cache. See Mode in which to operate the files cache. See
https://borgbackup.readthedocs.io/en/stable/usage/create.html#description for https://borgbackup.readthedocs.io/en/stable/usage/create.html#description for
details. Defaults to "ctime,size,inode". details. Defaults to "ctime,size,inode".
example: ctime,size,inode example: ctime,size,inode
local_path: local_path:
type: scalar type: str
desc: Alternate Borg local executable. Defaults to "borg". desc: Alternate Borg local executable. Defaults to "borg".
example: borg1 example: borg1
remote_path: remote_path:
type: scalar type: str
desc: Alternate Borg remote executable. Defaults to "borg". desc: Alternate Borg remote executable. Defaults to "borg".
example: borg1 example: borg1
patterns: patterns:
seq: seq:
- type: scalar - type: str
desc: | desc: |
Any paths matching these patterns are included/excluded from backups. Globs are Any paths matching these patterns are included/excluded from backups. Globs are
expanded. (Tildes are not.) Note that Borg considers this option experimental. expanded. (Tildes are not.) Note that Borg considers this option experimental.
@ -89,7 +89,7 @@ map:
- '- /home/*' - '- /home/*'
patterns_from: patterns_from:
seq: seq:
- type: scalar - type: str
desc: | desc: |
Read include/exclude patterns from one or more separate named files, one pattern Read include/exclude patterns from one or more separate named files, one pattern
per line. Note that Borg considers this option experimental. See the output of per line. Note that Borg considers this option experimental. See the output of
@ -98,7 +98,7 @@ map:
- /etc/borgmatic/patterns - /etc/borgmatic/patterns
exclude_patterns: exclude_patterns:
seq: seq:
- type: scalar - type: str
desc: | desc: |
Any paths matching these patterns are excluded from backups. Globs and tildes Any paths matching these patterns are excluded from backups. Globs and tildes
are expanded. See the output of "borg help patterns" for more details. are expanded. See the output of "borg help patterns" for more details.
@ -108,7 +108,7 @@ map:
- /etc/ssl - /etc/ssl
exclude_from: exclude_from:
seq: seq:
- type: scalar - type: str
desc: | desc: |
Read exclude patterns from one or more separate named files, one pattern per Read exclude patterns from one or more separate named files, one pattern per
line. See the output of "borg help patterns" for more details. line. See the output of "borg help patterns" for more details.
@ -121,7 +121,7 @@ map:
http://www.brynosaurus.com/cachedir/spec.html for details. Defaults to false. http://www.brynosaurus.com/cachedir/spec.html for details. Defaults to false.
example: true example: true
exclude_if_present: exclude_if_present:
type: scalar type: str
desc: | desc: |
Exclude directories that contain a file with the given filename. Defaults to not Exclude directories that contain a file with the given filename. Defaults to not
set. set.
@ -134,7 +134,7 @@ map:
details. details.
map: map:
encryption_passcommand: encryption_passcommand:
type: scalar type: str
desc: | desc: |
The standard output of this command is used to unlock the encryption key. Only The standard output of this command is used to unlock the encryption key. Only
use on repositories that were initialized with passcommand/repokey encryption. use on repositories that were initialized with passcommand/repokey encryption.
@ -142,7 +142,7 @@ map:
then encryption_passphrase takes precedence. Defaults to not set. then encryption_passphrase takes precedence. Defaults to not set.
example: "secret-tool lookup borg-repository repo-name" example: "secret-tool lookup borg-repository repo-name"
encryption_passphrase: encryption_passphrase:
type: scalar type: str
desc: | desc: |
Passphrase to unlock the encryption key with. Only use on repositories that were Passphrase to unlock the encryption key with. Only use on repositories that were
initialized with passphrase/repokey encryption. Quote the value if it contains initialized with passphrase/repokey encryption. Quote the value if it contains
@ -157,14 +157,14 @@ map:
for details. Defaults to checkpoints every 1800 seconds (30 minutes). for details. Defaults to checkpoints every 1800 seconds (30 minutes).
example: 1800 example: 1800
chunker_params: chunker_params:
type: scalar type: str
desc: | desc: |
Specify the parameters passed to then chunker (CHUNK_MIN_EXP, CHUNK_MAX_EXP, Specify the parameters passed to then chunker (CHUNK_MIN_EXP, CHUNK_MAX_EXP,
HASH_MASK_BITS, HASH_WINDOW_SIZE). See https://borgbackup.readthedocs.io/en/stable/internals.html HASH_MASK_BITS, HASH_WINDOW_SIZE). See https://borgbackup.readthedocs.io/en/stable/internals.html
for details. Defaults to "19,23,21,4095". for details. Defaults to "19,23,21,4095".
example: 19,23,21,4095 example: 19,23,21,4095
compression: compression:
type: scalar type: str
desc: | desc: |
Type of compression to use when creating archives. See Type of compression to use when creating archives. See
https://borgbackup.readthedocs.org/en/stable/usage.html#borg-create for details. https://borgbackup.readthedocs.org/en/stable/usage.html#borg-create for details.
@ -175,34 +175,34 @@ map:
desc: Remote network upload rate limit in kiBytes/second. Defaults to unlimited. desc: Remote network upload rate limit in kiBytes/second. Defaults to unlimited.
example: 100 example: 100
ssh_command: ssh_command:
type: scalar type: str
desc: | desc: |
Command to use instead of "ssh". This can be used to specify ssh options. Command to use instead of "ssh". This can be used to specify ssh options.
Defaults to not set. Defaults to not set.
example: ssh -i /path/to/private/key example: ssh -i /path/to/private/key
borg_base_directory: borg_base_directory:
type: scalar type: str
desc: | desc: |
Base path used for various Borg directories. Defaults to $HOME, ~$USER, or ~. Base path used for various Borg directories. Defaults to $HOME, ~$USER, or ~.
See https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables for details. See https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables for details.
example: /path/to/base example: /path/to/base
borg_config_directory: borg_config_directory:
type: scalar type: str
desc: | desc: |
Path for Borg configuration files. Defaults to $borg_base_directory/.config/borg Path for Borg configuration files. Defaults to $borg_base_directory/.config/borg
example: /path/to/base/config example: /path/to/base/config
borg_cache_directory: borg_cache_directory:
type: scalar type: str
desc: | desc: |
Path for Borg cache files. Defaults to $borg_base_directory/.cache/borg Path for Borg cache files. Defaults to $borg_base_directory/.cache/borg
example: /path/to/base/cache example: /path/to/base/cache
borg_security_directory: borg_security_directory:
type: scalar type: str
desc: | desc: |
Path for Borg security and encryption nonce files. Defaults to $borg_base_directory/.config/borg/security Path for Borg security and encryption nonce files. Defaults to $borg_base_directory/.config/borg/security
example: /path/to/base/config/security example: /path/to/base/config/security
borg_keys_directory: borg_keys_directory:
type: scalar type: str
desc: | desc: |
Path for Borg encryption key files. Defaults to $borg_base_directory/.config/borg/keys Path for Borg encryption key files. Defaults to $borg_base_directory/.config/borg/keys
example: /path/to/base/config/keys example: /path/to/base/config/keys
@ -215,7 +215,7 @@ map:
desc: Maximum seconds to wait for acquiring a repository/cache lock. Defaults to 1. desc: Maximum seconds to wait for acquiring a repository/cache lock. Defaults to 1.
example: 5 example: 5
archive_name_format: archive_name_format:
type: scalar type: str
desc: | desc: |
Name of the archive. Borg placeholders can be used. See the output of Name of the archive. Borg placeholders can be used. See the output of
"borg help placeholders" for details. Defaults to "borg help placeholders" for details. Defaults to
@ -233,7 +233,7 @@ map:
if you'd like to skip pruning entirely. if you'd like to skip pruning entirely.
map: map:
keep_within: keep_within:
type: scalar type: str
desc: Keep all archives within this time interval. desc: Keep all archives within this time interval.
example: 3H example: 3H
keep_secondly: keep_secondly:
@ -265,7 +265,7 @@ map:
desc: Number of yearly archives to keep. desc: Number of yearly archives to keep.
example: 1 example: 1
prefix: prefix:
type: scalar type: str
desc: | desc: |
When pruning, only consider archive names starting with this prefix. When pruning, only consider archive names starting with this prefix.
Borg placeholders can be used. See the output of "borg help placeholders" for Borg placeholders can be used. See the output of "borg help placeholders" for
@ -293,7 +293,7 @@ map:
- archives - archives
check_repositories: check_repositories:
seq: seq:
- type: scalar - type: str
desc: | desc: |
Paths to a subset of the repositories in the location section on which to run Paths to a subset of the repositories in the location section on which to run
consistency checks. Handy in case some of your repositories are very large, and consistency checks. Handy in case some of your repositories are very large, and
@ -307,7 +307,7 @@ map:
"archives" check. Defaults to checking all archives. "archives" check. Defaults to checking all archives.
example: 3 example: 3
prefix: prefix:
type: scalar type: str
desc: | desc: |
When performing the "archives" check, only consider archive names starting with When performing the "archives" check, only consider archive names starting with
this prefix. Borg placeholders can be used. See the output of this prefix. Borg placeholders can be used. See the output of
@ -333,19 +333,19 @@ map:
map: map:
before_backup: before_backup:
seq: seq:
- type: scalar - type: str
desc: List of one or more shell commands or scripts to execute before creating a backup. desc: List of one or more shell commands or scripts to execute before creating a backup.
example: example:
- echo "Starting a backup job." - echo "Starting a backup job."
after_backup: after_backup:
seq: seq:
- type: scalar - type: str
desc: List of one or more shell commands or scripts to execute after creating a backup. desc: List of one or more shell commands or scripts to execute after creating a backup.
example: example:
- echo "Backup created." - echo "Backup created."
on_error: on_error:
seq: seq:
- type: scalar - type: str
desc: | desc: |
List of one or more shell commands or scripts to execute when an exception occurs List of one or more shell commands or scripts to execute when an exception occurs
during a backup or when running a hook. during a backup or when running a hook.