Skip to content

Commit

Permalink
build: add system check to warn of pending devstack settings removal
Browse files Browse the repository at this point in the history
Note: I had originally implemented this as a `warnings.warn()` call
directly in lms/envs/devstack.py and cms/envs/devstack.py, but for
whatever reason, those warnings were getting swallowed. System checks
display more prominently, anyway.

Part of: openedx/public-engineering#247
  • Loading branch information
kdmccormick committed May 15, 2024
1 parent 72a15e3 commit 7d7a18d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/util/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ def ready(self):
"""
Registers signal handlers at startup.
"""
import openedx.core.djangoapps.util.signals # lint-amnesty, pylint: disable=unused-import, unused-variable
import openedx.core.djangoapps.util.signals # pylint: disable=unused-import, unused-variable
import openedx.core.djangoapps.util.checks # pylint: disable=unused-import, unused-variable
36 changes: 36 additions & 0 deletions openedx/core/djangoapps/util/checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
Miscellaneous system checks
"""
from django.conf import settings
from django.core import checks


_DEVSTACK_SETTINGS_MODULES = [
"lms.envs.devstack",
"lms.envs.devstack_docker",
"lms.envs.devstack_optimized",
"lms.envs.devstack_with_worker",
"cms.envs.devstack",
"cms.envs.devstack_docker",
"cms.envs.devstack_optimized",
"cms.envs.devstack_with_worker",
]


@checks.register(checks.Tags.compatibility)
def warn_if_devstack_settings(**kwargs):
"""
Raises a warning if we're using any Devstack settings file.
"""
if settings.SETTINGS_MODULE in _DEVSTACK_SETTINGS_MODULES:
return [
checks.Warning(
"Open edX Devstack is deprecated, so the Django settings module you are using "
f"({settings.SETTINGS_MODULE}) will be removed from openedx/edx-platform by October 2024. "
"Please either migrate off of Devstack, or modify your Devstack fork to work with an externally-"
"managed Django settings file. "
"For details and discussion, see: https://github.com/openedx/public-engineering/issues/247.",
id="openedx.core.djangoapps.util.W247",
),
]
return []

0 comments on commit 7d7a18d

Please sign in to comment.