From 3437d8b4b0a1aab3c62c5a9d4df4ba9bc127f974 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 27 Feb 2021 16:26:06 +0100 Subject: [PATCH] flows: handle error when app cannot be found during import --- authentik/flows/transfer/importer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/authentik/flows/transfer/importer.py b/authentik/flows/transfer/importer.py index 76e5bc2fe..c66e4dd23 100644 --- a/authentik/flows/transfer/importer.py +++ b/authentik/flows/transfer/importer.py @@ -152,7 +152,13 @@ class FlowImporter: entries = deepcopy(self.__import.entries) for entry in entries: model_app_label, model_name = entry.model.split(".") - model: SerializerModel = apps.get_model(model_app_label, model_name) + try: + model: SerializerModel = apps.get_model(model_app_label, model_name) + except LookupError: + self.logger.error( + "app or model does not exist", app=model_app_label, model=model_name + ) + return False # Validate each single entry try: serializer = self._validate_single(entry)