Merge 'upstream/master' into list-files
This commit is contained in:
commit
5f0c084bee
9 changed files with 51 additions and 20 deletions
8
NEWS
8
NEWS
|
@ -1,10 +1,12 @@
|
||||||
1.4.22.dev0-files
|
1.4.23.dev0
|
||||||
|
* #274: Add ~/.config/borgmatic.d as another configuration directory default.
|
||||||
* Removed `borg --list --stats` option from `create`and `prune` actions at verbosity 1
|
* Removed `borg --list --stats` option from `create`and `prune` actions at verbosity 1
|
||||||
* The `--stats` now always requires to use the `borgmatic --stats` option to be enabled.
|
* The `--stats` now always requires to use the `borgmatic --stats` option to be enabled.
|
||||||
* New option `--files` to (re-)add the `borg` `--list` at verbosity 1
|
* New option `--files` to (re-)add the `borg` `--list` at verbosity 1
|
||||||
|
|
||||||
1.4.22.dev0
|
1.4.22
|
||||||
* #276: Disable colored output when "--json" flag is used, so as to produce valid JSON ouput.
|
* #276, #285: Disable colored output when "--json" flag is used, so as to produce valid JSON ouput.
|
||||||
|
* After a backup of a database dump in directory format, properly remove the dump directory.
|
||||||
* In "borgmatic --help", don't expand $HOME in listing of default "--config" paths.
|
* In "borgmatic --help", don't expand $HOME in listing of default "--config" paths.
|
||||||
|
|
||||||
1.4.21
|
1.4.21
|
||||||
|
|
|
@ -20,9 +20,11 @@ location:
|
||||||
- /home
|
- /home
|
||||||
- /etc
|
- /etc
|
||||||
|
|
||||||
# Paths to local or remote repositories.
|
# Paths of local or remote repositories to backup to.
|
||||||
repositories:
|
repositories:
|
||||||
- user@backupserver:sourcehostname.borg
|
- 1234@usw-s001.rsync.net:backups.borg
|
||||||
|
- k8pDxu32@k8pDxu32.repo.borgbase.com:repo
|
||||||
|
- /var/lib/backups/backups.borg
|
||||||
|
|
||||||
retention:
|
retention:
|
||||||
# Retention policy for how many backups to keep.
|
# Retention policy for how many backups to keep.
|
||||||
|
|
|
@ -17,6 +17,7 @@ def get_default_config_paths(expand_home=True):
|
||||||
'/etc/borgmatic/config.yaml',
|
'/etc/borgmatic/config.yaml',
|
||||||
'/etc/borgmatic.d',
|
'/etc/borgmatic.d',
|
||||||
'%s/borgmatic/config.yaml' % user_config_directory,
|
'%s/borgmatic/config.yaml' % user_config_directory,
|
||||||
|
'%s/borgmatic.d' % user_config_directory,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import glob
|
import glob
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
from borgmatic.borg.create import DEFAULT_BORGMATIC_SOURCE_DIRECTORY
|
from borgmatic.borg.create import DEFAULT_BORGMATIC_SOURCE_DIRECTORY
|
||||||
|
|
||||||
|
@ -83,6 +84,9 @@ def remove_database_dumps(dump_path, databases, database_type_name, log_prefix,
|
||||||
if dry_run:
|
if dry_run:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if os.path.isdir(dump_filename):
|
||||||
|
shutil.rmtree(dump_filename)
|
||||||
|
else:
|
||||||
os.remove(dump_filename)
|
os.remove(dump_filename)
|
||||||
dump_file_dir = os.path.dirname(dump_filename)
|
dump_file_dir = os.path.dirname(dump_filename)
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,10 @@ for each configuration file one at a time. In other words, borgmatic does not
|
||||||
perform any merging of configuration files by default. If you'd like borgmatic
|
perform any merging of configuration files by default. If you'd like borgmatic
|
||||||
to merge your configuration files, see below about configuration includes.
|
to merge your configuration files, see below about configuration includes.
|
||||||
|
|
||||||
And if you need even more customizability, you can specify alternate
|
Additionally, the `~/.config/borgmatic.d/` directory works the same way as
|
||||||
configuration paths on the command-line with borgmatic's `--config` option.
|
`/etc/borgmatic.d`. If you need even more customizability, you can specify
|
||||||
See `borgmatic --help` for more information.
|
alternate configuration paths on the command-line with borgmatic's `--config`
|
||||||
|
flag. See `borgmatic --help` for more information.
|
||||||
|
|
||||||
|
|
||||||
## Configuration includes
|
## Configuration includes
|
||||||
|
|
|
@ -68,10 +68,13 @@ sudo generate-borgmatic-config
|
||||||
If that command is not found, then it may be installed in a location that's
|
If that command is not found, then it may be installed in a location that's
|
||||||
not in your system `PATH` (see above). Try looking in `~/.local/bin/`.
|
not in your system `PATH` (see above). Try looking in `~/.local/bin/`.
|
||||||
|
|
||||||
This generates a sample configuration file at /etc/borgmatic/config.yaml (by
|
This generates a sample configuration file at `/etc/borgmatic/config.yaml` by
|
||||||
default). You should edit the file to suit your needs, as the values are
|
default. If you'd like to use another path, use the `--destination` flag, for
|
||||||
representative. All options are optional except where indicated, so feel free
|
instance: `--destination ~/.config/borgmatic/config.yaml`.
|
||||||
to ignore anything you don't need.
|
|
||||||
|
You should edit the configuration file to suit your needs, as the generated
|
||||||
|
values are only representative. All options are optional except where
|
||||||
|
indicated, so feel free to ignore anything you don't need.
|
||||||
|
|
||||||
Note that the configuration file is organized into distinct sections, each
|
Note that the configuration file is organized into distinct sections, each
|
||||||
with a section name like `location:` or `storage:`. So take care that if you
|
with a section name like `location:` or `storage:`. So take care that if you
|
||||||
|
@ -79,12 +82,11 @@ uncomment a particular option, also uncomment its containing section name, or
|
||||||
else borgmatic won't recognize the option. Also be sure to use spaces rather
|
else borgmatic won't recognize the option. Also be sure to use spaces rather
|
||||||
than tabs for indentation; YAML does not allow tabs.
|
than tabs for indentation; YAML does not allow tabs.
|
||||||
|
|
||||||
You can also get the same sample configuration file from the [configuration
|
You can get the same sample configuration file from the [configuration
|
||||||
reference](https://torsion.org/borgmatic/docs/reference/configuration/), the
|
reference](https://torsion.org/borgmatic/docs/reference/configuration/), the
|
||||||
authoritative set of all configuration options. This is handy if borgmatic has
|
authoritative set of all configuration options. This is handy if borgmatic has
|
||||||
added new options
|
added new options since you originally created your configuration file. Also
|
||||||
since you originally created your configuration file. Also check out how to
|
check out how to [upgrade your
|
||||||
[upgrade your
|
|
||||||
configuration](https://torsion.org/borgmatic/docs/how-to/upgrade/#upgrading-your-configuration).
|
configuration](https://torsion.org/borgmatic/docs/how-to/upgrade/#upgrading-your-configuration).
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,6 +175,9 @@ The verbosity flag makes borgmatic list the files that it's archiving, which
|
||||||
are those that are new or changed since the last backup. Eyeball the list and
|
are those that are new or changed since the last backup. Eyeball the list and
|
||||||
see if it matches your expectations based on the configuration.
|
see if it matches your expectations based on the configuration.
|
||||||
|
|
||||||
|
If you'd like to specify an alternate configuration file path, use the
|
||||||
|
`--config` flag. See `borgmatic --help` for more information.
|
||||||
|
|
||||||
|
|
||||||
## Autopilot
|
## Autopilot
|
||||||
|
|
||||||
|
|
|
@ -20,5 +20,5 @@ Restart=no
|
||||||
LogRateLimitIntervalSec=0
|
LogRateLimitIntervalSec=0
|
||||||
|
|
||||||
# Delay start to prevent backups running during boot.
|
# Delay start to prevent backups running during boot.
|
||||||
ExecStartPre=/usr/bin/sleep 1m
|
ExecStartPre=sleep 1m
|
||||||
ExecStart=/usr/bin/systemd-inhibit --who="borgmatic" --why="Prevent interrupting scheduled backup" /root/.local/bin/borgmatic --syslog-verbosity 1
|
ExecStart=systemd-inhibit --who="borgmatic" --why="Prevent interrupting scheduled backup" /root/.local/bin/borgmatic --syslog-verbosity 1
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -1,6 +1,6 @@
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
VERSION = '1.4.22.dev0-files'
|
VERSION = '1.4.23.dev0'
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
|
@ -66,6 +66,7 @@ def test_remove_database_dumps_removes_dump_for_each_database():
|
||||||
'databases', 'bar', None
|
'databases', 'bar', None
|
||||||
).and_return('databases/localhost/bar')
|
).and_return('databases/localhost/bar')
|
||||||
|
|
||||||
|
flexmock(module.os.path).should_receive('isdir').and_return(False)
|
||||||
flexmock(module.os).should_receive('remove').with_args('databases/localhost/foo').once()
|
flexmock(module.os).should_receive('remove').with_args('databases/localhost/foo').once()
|
||||||
flexmock(module.os).should_receive('remove').with_args('databases/localhost/bar').once()
|
flexmock(module.os).should_receive('remove').with_args('databases/localhost/bar').once()
|
||||||
flexmock(module.os).should_receive('listdir').with_args('databases/localhost').and_return(
|
flexmock(module.os).should_receive('listdir').with_args('databases/localhost').and_return(
|
||||||
|
@ -77,6 +78,21 @@ def test_remove_database_dumps_removes_dump_for_each_database():
|
||||||
module.remove_database_dumps('databases', databases, 'SuperDB', 'test.yaml', dry_run=False)
|
module.remove_database_dumps('databases', databases, 'SuperDB', 'test.yaml', dry_run=False)
|
||||||
|
|
||||||
|
|
||||||
|
def test_remove_database_dumps_removes_dump_in_directory_format():
|
||||||
|
databases = [{'name': 'foo'}]
|
||||||
|
flexmock(module).should_receive('make_database_dump_filename').with_args(
|
||||||
|
'databases', 'foo', None
|
||||||
|
).and_return('databases/localhost/foo')
|
||||||
|
|
||||||
|
flexmock(module.os.path).should_receive('isdir').and_return(True)
|
||||||
|
flexmock(module.os).should_receive('remove').never()
|
||||||
|
flexmock(module.shutil).should_receive('rmtree').with_args('databases/localhost/foo').once()
|
||||||
|
flexmock(module.os).should_receive('listdir').with_args('databases/localhost').and_return([])
|
||||||
|
flexmock(module.os).should_receive('rmdir').with_args('databases/localhost').once()
|
||||||
|
|
||||||
|
module.remove_database_dumps('databases', databases, 'SuperDB', 'test.yaml', dry_run=False)
|
||||||
|
|
||||||
|
|
||||||
def test_remove_database_dumps_with_dry_run_skips_removal():
|
def test_remove_database_dumps_with_dry_run_skips_removal():
|
||||||
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
||||||
flexmock(module.os).should_receive('rmdir').never()
|
flexmock(module.os).should_receive('rmdir').never()
|
||||||
|
|
Loading…
Reference in a new issue