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

This commit is contained in:
Dan Helfman 2019-10-27 14:47:55 -07:00
parent 5e3c2da79c
commit 4dc4fe0b8d

View file

@ -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
)