Compare commits

...

2 Commits

Author SHA1 Message Date
d537393da8 Solved array bug 2024-01-09 13:18:17 +01:00
2b716e5d90 Optimized code performance 2024-01-09 12:59:53 +01:00

View File

@ -142,7 +142,7 @@ def get_last_backup_dir(volume_name, current_backup_dir):
return None return None
def getStoragePath(volume_name): def getStoragePath(volume_name):
return execute_shell_command(f"docker volume inspect --format '{{{{ .Mountpoint }}}}' {volume_name}") return execute_shell_command(f"docker volume inspect --format '{{{{ .Mountpoint }}}}' {volume_name}")[0]
def backup_volume(volume_name, volume_dir): def backup_volume(volume_name, volume_dir):
"""Backup files of a volume with incremental backups.""" """Backup files of a volume with incremental backups."""
@ -168,15 +168,15 @@ def has_image(container,image):
def stop_containers(containers): def stop_containers(containers):
"""Stop a list of containers.""" """Stop a list of containers."""
for container in containers: container_list = ' '.join(containers)
print(f"Stopping container {container}...") print(f"Stopping containers {container_list}...")
execute_shell_command(f"docker stop {container}") execute_shell_command(f"docker stop {container_list}")
def start_containers(containers): def start_containers(containers):
"""Start a list of stopped containers.""" """Start a list of containers."""
for container in containers: container_list = ' '.join(containers)
print(f"Starting container {container}...") print(f"Start containers {container_list}...")
execute_shell_command(f"docker start {container}") execute_shell_command(f"docker start {container_list}")
def get_container_with_image(containers,image): def get_container_with_image(containers,image):
for container in containers: for container in containers: