Changeset - 35140b3eb5b8
[Not reviewed]
0 4 0
Branko Majic (branko) - 8 months ago 2024-02-14 22:49:37
branko@majic.rs
MAR-198: Implement removal of expired backups via backup_client role:

- In addition to expired backup removals, ensure that the backup
does not proceed if previous execution step has failed. This means
that pre-scripts now have to run without errors for the main backup
to kick-in.
- Could not use full _and_ chaining of duply. For example, if we have
A_and_B_and_C (where A/B/C are duply backup commands), if A
fails, B will be skipped, but C will still run because B has ran
without_errors.
4 files changed with 16 insertions and 3 deletions:
0 comments (0 inline, 0 general)
docs/releasenotes.rst
Show inline comments
 
@@ -13,6 +13,16 @@ Dropped support for Debian 10 (Buster).
 

	
 
  * Dropped support for Debian 10 (Buster).
 

	
 
* ``backup_client`` role
 

	
 
  * Previously the backup would run even if pre-backup scripts would
 
    fail. This is no longer the case, and all pre-backup scripts must
 
    exit with non-zero exit code in order for backup process to
 
    kick-in.
 
  * Old backups are now automatically purged after successful
 
    backup. This could lead to longer runtimes for entire backup
 
    process, as well as higher CPU usage.
 

	
 
* ``common`` role
 

	
 
  * Dropped support for Python 2.7 pip requirements upgrade
docs/rolereference.rst
Show inline comments
 
@@ -2280,6 +2280,9 @@ Duply is configured as follows:
 
* Volume size is set to 1GB.
 
* Pre-backup scripts are run via ``/etc/duply/main/pre`` handler that tries to
 
  execute scripts/binaries from directory ``/etc/duply/main/pre.d/``.
 
* Pre-backup scripts must run successfully for the actual backup
 
  process to proceed.
 
* Old backups are automatically purged in case of successful run.
 

	
 
.. note::
 
   Since at time of this writing there are no lookup plugins for extracting key
roles/backup_client/molecule/default/tests/test_default.py
Show inline comments
 
@@ -173,7 +173,7 @@ def test_cron_entry(host):
 
    assert cron.user == 'root'
 
    assert cron.group == 'root'
 
    assert cron.mode == 0o644
 
    assert cron.content_string == "#Ansible: backup\n0 2 * * * root /usr/bin/duply main backup\n"
 
    assert cron.content_string == "#Ansible: backup\n0 2 * * * root /usr/bin/duply main pre_and_bkp && /usr/bin/duply main post_and_purge --force\n"
 

	
 

	
 
def test_duply_include_file(host):
 
@@ -202,7 +202,7 @@ def test_backup_and_restore(host):
 
        # Remove this file so we can be sure the pre-backup script has been run.
 
        host.ansible("file", "path=/var/lib/pre-backup-test state=absent")
 

	
 
        backup_run = host.run('duply main backup')
 
        backup_run = host.run('duply main pre_and_bkp')
 

	
 
        assert backup_run.rc == 0
 
        assert host.file('/var/lib/pre-backup-test').is_file
roles/backup_client/tasks/main.yml
Show inline comments
 
@@ -131,7 +131,7 @@
 
    cron_file: backup
 
    hour: "2"
 
    minute: "0"
 
    job: "/usr/bin/duply main backup"
 
    job: "/usr/bin/duply main pre_and_bkp && /usr/bin/duply main post_and_purge --force"
 
    state: present
 
    user: root
 

	
0 comments (0 inline, 0 general)