Browse Source

Reordering hooks a bit so that pre-backup ordering mirrors post-backup ordering.

Dan Helfman 5 years ago
parent
commit
4dc4fe0b8d
1 changed files with 6 additions and 6 deletions
  1. 6 6
      borgmatic/commands/borgmatic.py

+ 6 - 6
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
             )