Skip to content

Commit

Permalink
Requires Pulp plugins to provide version
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bmbouter committed Feb 2, 2021
1 parent c600ff1 commit 9d5a5b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES/plugin_api/7930.removal
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions pulpcore/app/apps.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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. <module 'pulp_plugin.app.viewsets'
# from 'pulp_plugin/app/viewsets.py'>. Set by import_viewsets().
Expand Down

0 comments on commit 9d5a5b5

Please sign in to comment.