Removed redundant code

This commit is contained in:
Kevin Veen-Birkenbach 2023-12-27 21:36:07 +01:00
parent 9a5b544e0b
commit 0322eee107

View File

@ -189,16 +189,11 @@ def backup_with_containers_paused(volume_name, volume_dir, versions_dir, contain
start_containers(containers) start_containers(containers)
def backup_mariadb_or_postgres(container, volume_dir): def backup_mariadb_or_postgres(container, volume_dir):
# Execute MariaDB procedure '''Performs database image specific backup procedures'''
if has_image(container, 'mariadb'): for image in ['mariadb','postgres']:
backup_database(container, volume_dir, 'mariadb') if has_image(container, image):
return True backup_database(container, volume_dir, image)
return True
# Execute Postgres procedure
if has_image(container, 'postgres'):
backup_database(container, volume_dir, 'postgres')
return True
return False return False
@ -228,9 +223,11 @@ def default_backup_routine_for_volume(volume_name, containers, version_dir, vers
def backup_everything(volume_name, containers, version_dir, versions_dir): def backup_everything(volume_name, containers, version_dir, versions_dir):
"""Perform file backup routine for a given volume.""" """Perform file backup routine for a given volume."""
volume_dir=create_volume_directory(version_dir, volume_name) volume_dir=create_volume_directory(version_dir, volume_name)
# Execute sql dumps # Execute sql dumps
for container in containers: for container in containers:
backup_mariadb_or_postgres(container, volume_dir) backup_mariadb_or_postgres(container, volume_dir)
# Execute file backups # Execute file backups
backup_volume(volume_name, volume_dir, versions_dir) backup_volume(volume_name, volume_dir, versions_dir)
backup_with_containers_paused(volume_name, volume_dir, versions_dir, containers) backup_with_containers_paused(volume_name, volume_dir, versions_dir, containers)