From 2bbd3290478702cb84d1dd3f2b1ccf186f69947c Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sun, 8 Dec 2019 01:05:26 +0100 Subject: [PATCH] Alert when backup process is already running --- src/restic_compose_backup/cli.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/restic_compose_backup/cli.py b/src/restic_compose_backup/cli.py index b4b7e22..7b13040 100644 --- a/src/restic_compose_backup/cli.py +++ b/src/restic_compose_backup/cli.py @@ -87,7 +87,15 @@ def backup(config, containers): """Request a backup to start""" # Make sure we don't spawn multiple backup processes if containers.backup_process_running: - raise ValueError("Backup process already running") + alerts.send( + subject="Backup process container already running", + body=( + "A backup process container is already running. \n" + f"Id: {containers.backup_process_container.id}\n" + f"Name: {containers.backup_process_container.name}\n" + ) + ) + raise RuntimeError("Backup process already running") # Map all volumes from the backup container into the backup process container volumes = containers.this_container.volumes