-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Attempt 2] refactor: Clean up lms/envs/production.py cruft #36131
base: master
Are you sure you want to change the base?
[Attempt 2] refactor: Clean up lms/envs/production.py cruft #36131
Conversation
b70d54a
to
c0cb126
Compare
Note: Test plan being discussed in Slack, with request not to merge without a plan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look through again with a finer view of the additions to make sure there weren't any typos and I was able to bring up the LMS and CMS from this version of the settings file and the minimal.yaml locally so I think it's good to go but I'll wait till we add the unit test that we were discussing in slack before providing the final approval.
(rephrasing from Slack) I don't see any way to unit test this PR, since unit tests use lms/envs/test.py, which is based directly on lms/envs/common.py, not lms/envs/production.py. I think we will have to rely on code review, manual testing, and the PR sandbox for verification. |
Sandbox deployment failed 💥 |
Sandbox deployment successful 🚀 |
This command dumps the current Django settings to JSON for debugging/diagnostics. The output of this command is for *humans*... it is NOT suitable for consumption by production systems. In particular, we are introducing this command as part of a series of refactorings to the Django settings files lms/envs/* and cms/envs/*. We want to ensure that these refactorings do not introduce any unexpected breaking changes, so the dump_settings command will both help us manually verify our refactorings and help operators verify that our refactorings behave expectedly when using their custom python/yaml settings files. Related to: openedx#36131
This command dumps the current Django settings to JSON for debugging/diagnostics. The output of this command is for *humans*... it is NOT suitable for consumption by production systems. In particular, we are introducing this command as part of a series of refactorings to the Django settings files lms/envs/* and cms/envs/*. We want to ensure that these refactorings do not introduce any unexpected breaking changes, so the dump_settings command will both help us manually verify our refactorings and help operators verify that our refactorings behave expectedly when using their custom python/yaml settings files. Related to: openedx#36131
This command dumps the current Django settings to JSON for debugging/diagnostics. The output of this command is for *humans*... it is NOT suitable for consumption by production systems. In particular, we are introducing this command as part of a series of refactorings to the Django settings files lms/envs/* and cms/envs/*. We want to ensure that these refactorings do not introduce any unexpected breaking changes, so the dump_settings command will both help us manually verify our refactorings and help operators verify that our refactorings behave expectedly when using their custom python/yaml settings files. Related to: #36131
c0cb126
to
8cd5c90
Compare
Converting this to draft until I can manually reverify it using |
Sandbox deployment failed 💥 |
8cd5c90
to
0e4126a
Compare
Sandbox deployment successful 🚀 |
0e4126a
to
49cbd81
Compare
Sandbox deployment successful 🚀 |
This reintroduces commit 1593923, which was reverted due to a typo. The typo is fixed in the commit immediately following this one. Co-Authored-By: Feanil Patel <feanil@axim.org>
In the near term, we wish to precisely preserve the existing values of all Django settings exposed by lms/envs/production.py in order to avoid breaking legacy Django plugins without a proper announcement. That includes preserving the behavior of these old, redundant dicts: * ENV_TOKENS * AUTH_TOKENS * ENV_FEATURES * ENV_CELERY_QUEUES * ALTERNATE_QUEUE_ENVS Particularly, it means we need to ensure that updates to Django settings are reflected in these dicts. The most reliable way to do that is to change the yaml-loading logic so that these values are aliased to the corresponding values in the global namespace rather than deep-copied. Finally, we remove KEYS_WITH_MERGED_VALUES from the global namespace, and inline the remaining list. We have modified the list (specifically, we dropped the no-op MKTG_URL_OVERRIDES). Plugins should not be counting on the value of the list, so we remove it.
49cbd81
to
b83dd8c
Compare
Sandbox deployment successful 🚀 |
Thanks @kdmccormick. I'm going to have @dianakhuang take over anything required to get this over-the-line from 2U's end. Thanks! |
Sounds good @robrap . Since non-SRE engineers cannot run management commands on stage (unless that changed since I left), I would recommend using a prod-like yaml file to compare the output of |
Yes. @dianakhuang is working on getting a prod-like yaml file on a sandbox. |
Description
This PR has 3 commits:
ENV_TOKENS
and a few other "auxillary" settings dictionaries, out of an abundance of caution and a desire not to break any existing Django plugins unintentionally. See commit description for more info.Altogether, this PR makes exactly ONE change to lms/envs/production.py, and that is the removal of
KEYS_WITH_MERGED_VALUES
from the settings namespace. This "setting" was an internal implementation detail of production.py, which should have been prefixed with an underscore. I am not considering this a breaking change.Otherwise, this PR should exactly preserve the global namespace of lms/envs/production.py given any LMS_CFG yaml file.
Testing Instructions
Here is a little script you can paste into edx-platform/diff_settings.sh (note the Tutor vs non-Tutor difference):
Ensure you have this PR's branch checked out and a updated master branch, and then run:
You should see that the only diff is the removal of
KEYS_WITH_MERGED_VALUES
from the LMS files: