From e0e7c1c98dec59377783225e4adb3f637bd99aca Mon Sep 17 00:00:00 2001 From: Brian Bouterse Date: Mon, 1 Feb 2021 16:32:56 -0500 Subject: [PATCH] Requires Pulp plugins to provide version It adds enforcement that the version to be set on the `PulpPluginAppConfig` subclass. If an installed plugin does not specify its version Pulp will refuse to start. closes #7930 --- CHANGES/plugin_api/7930.removal | 3 +++ pulpcore/app/apps.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 CHANGES/plugin_api/7930.removal diff --git a/CHANGES/plugin_api/7930.removal b/CHANGES/plugin_api/7930.removal new file mode 100644 index 0000000000..98c43160a7 --- /dev/null +++ b/CHANGES/plugin_api/7930.removal @@ -0,0 +1,3 @@ +Plugins are required to define a ``version`` attribute on their subclass of +``PulpPluginAppConfig``. Starting with pulpcore==3.10, if undefined while Pulp loads, Pulp will +refuse to start. diff --git a/pulpcore/app/apps.py b/pulpcore/app/apps.py index 119e2b7060..0e57044924 100644 --- a/pulpcore/app/apps.py +++ b/pulpcore/app/apps.py @@ -1,9 +1,9 @@ from collections import defaultdict from gettext import gettext as _ from importlib import import_module -import warnings from django import apps +from django.core.exceptions import ImproperlyConfigured from django.db.models.signals import post_migrate from django.utils.module_loading import module_has_submodule @@ -65,11 +65,11 @@ def __init__(self, app_name, app_module): self.version except AttributeError: msg = _( - f"The plugin `{self.label}` is missing a version attribute. Starting with " + "The plugin `{}` is missing a version declaration. Starting with " "pulpcore==3.10, plugins are required to define their version on the " "PulpPluginAppConfig subclass." ) - warnings.warn(msg, FutureWarning) + raise ImproperlyConfigured(msg.format(self.label)) # Module containing viewsets eg. . Set by import_viewsets().