From f9f2e00913fe2768ee02b0ca864e2d53821e1610 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 13 May 2021 17:56:49 +0200 Subject: [PATCH] core: improve error handling for backups Signed-off-by: Jens Langhammer --- authentik/core/tasks.py | 1 + authentik/lib/sentry.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/authentik/core/tasks.py b/authentik/core/tasks.py index 99307f8a1..8a2f2d372 100644 --- a/authentik/core/tasks.py +++ b/authentik/core/tasks.py @@ -75,5 +75,6 @@ def backup_database(self: MonitoredTask): # pragma: no cover Boto3Error, PermissionError, CommandConnectorError, + ValueError, ) as exc: self.set_status(TaskResult(TaskResultStatus.ERROR).with_error(exc)) diff --git a/authentik/lib/sentry.py b/authentik/lib/sentry.py index 79a7b0d53..7ef05158f 100644 --- a/authentik/lib/sentry.py +++ b/authentik/lib/sentry.py @@ -4,6 +4,7 @@ from typing import Optional from aioredis.errors import ConnectionClosedError, ReplyError from billiard.exceptions import WorkerLostError from botocore.client import ClientError +from botocore.exceptions import BotoCoreError from celery.exceptions import CeleryError from channels.middleware import BaseMiddleware from channels_redis.core import ChannelFull @@ -72,6 +73,7 @@ def before_send(event: dict, hint: dict) -> Optional[dict]: WorkerLostError, CeleryError, # S3 errors + BotoCoreError, ClientError, # custom baseclass SentryIgnoredException, @@ -87,6 +89,6 @@ def before_send(event: dict, hint: dict) -> Optional[dict]: if isinstance(exc_value, ignored_classes): return None if "logger" in event: - if event["logger"] in ["dbbackup"]: + if event["logger"] in ["dbbackup", "botocore"]: return None return event