build: add system check to warn of pending devstack settings removal
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: https://github.com/openedx/public-engineering/issues/247
This commit is contained in:
committed by
Kyle McCormick
parent
72a15e36e9
commit
7d7a18d28b
@@ -18,4 +18,5 @@ class UtilConfig(AppConfig):
|
||||
"""
|
||||
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
openedx/core/djangoapps/util/checks.py
Normal file
36
openedx/core/djangoapps/util/checks.py
Normal file
@@ -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 []
|
||||
Reference in New Issue
Block a user