From 4dc4fe0b8d07a086663444a89f2aca00a645bfdd Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 27 Oct 2019 14:47:55 -0700 Subject: [PATCH] Reordering hooks a bit so that pre-backup ordering mirrors post-backup ordering. --- borgmatic/commands/borgmatic.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/borgmatic/commands/borgmatic.py b/borgmatic/commands/borgmatic.py index 70318b313..71abd05f2 100644 --- a/borgmatic/commands/borgmatic.py +++ b/borgmatic/commands/borgmatic.py @@ -53,6 +53,9 @@ def run_configuration(config_filename, config, arguments): if 'create' in arguments: try: + healthchecks.ping_healthchecks( + hooks.get('healthchecks'), config_filename, global_arguments.dry_run, 'start' + ) command.execute_hook( hooks.get('before_backup'), hooks.get('umask'), @@ -63,9 +66,6 @@ def run_configuration(config_filename, config, arguments): postgresql.dump_databases( hooks.get('postgresql_databases'), config_filename, global_arguments.dry_run ) - healthchecks.ping_healthchecks( - hooks.get('healthchecks'), config_filename, global_arguments.dry_run, 'start' - ) except (OSError, CalledProcessError) as error: encountered_error = error yield from make_error_log_records( @@ -94,6 +94,9 @@ def run_configuration(config_filename, config, arguments): if 'create' in arguments and not encountered_error: try: + postgresql.remove_database_dumps( + hooks.get('postgresql_databases'), config_filename, global_arguments.dry_run + ) command.execute_hook( hooks.get('after_backup'), hooks.get('umask'), @@ -101,9 +104,6 @@ def run_configuration(config_filename, config, arguments): 'post-backup', global_arguments.dry_run, ) - postgresql.remove_database_dumps( - hooks.get('postgresql_databases'), config_filename, global_arguments.dry_run - ) healthchecks.ping_healthchecks( hooks.get('healthchecks'), config_filename, global_arguments.dry_run )