Repository navigation
Conversation
Zulip's naming convention is to use "URL" rather than "URI". This setting is always computed from EXTERNAL_URI_SCHEME and EXTERNAL_HOST, and overrides any value in /etc/zulip/settings.py, so the old name needs no fallback for server administrators. The camo Puppet manifest does read it by name. During an upgrade, Puppet runs before the "current" deployment is switched to the new code, so asking only for the new name would fail there, and the go-camo User-Agent would fall back to https://zulip.com. The manifest now tries the new name first, then the old one. Fixes part of zulip#23380.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Next step for #23380 after #40191, but it doesn't depend on it. Unlike the avatar/logo settings there,
ROOT_DOMAIN_URIis always computed incomputed_settings.pyfromEXTERNAL_URI_SCHEMEandEXTERNAL_HOST, so a value in/etc/zulip/settings.pywas never used and admins don't need the old name kept.The one place that reads it by name is
puppet/zulip/manifests/camo.pp, for the go-camo User-Agent. Inupgrade-zulip-stage-3,zulip-puppet-applyruns from the new deployment beforerestart-serverswitches thecurrentsymlink, soget_django_setting_slowstill asks the old deployment. With only the new name, the lookup fails and the User-Agent sayshttps://zulip.comuntil Puppet is next applied. So the manifest triesROOT_DOMAIN_URLfirst, thenROOT_DOMAIN_URI, marked TODO/compatibility. (My plan on the issue said this one wouldn't need a fallback. That's still true for admins, but not for Puppet.)Fixes: part of #23380.
How changes were tested:
./tools/linton the changed files (includes mypy,puppet parser validateandpuppet-lint)../tools/test-backendfortest_home,test_email_log,test_create_video_call,test_link_embed,test_signup,test_auth_backends,test_docsandtest_realm../scripts/get-django-setting ROOT_DOMAIN_URLprints the URL in the dev environment, and the old name now fails.pick(...)withpuppet applyin a sandbox, using the realget_django_setting_slowagainst fake deployments: an old one that only hasROOT_DOMAIN_URI, a new one, a first install (onlynext/), and no/etc/zulip/settings.py. All gave the expected value. Without the fallback, the old-deployment case gavehttps://zulip.com.Open question:
pick()evaluates both lookups, so each Puppet run makes one extraget-django-settingcall (~350ms) until the fallback is removed. I kept it for readability. I can switch to anifthat only does the second lookup when the first one fails, if that's preferred.Screenshots and screen captures:
None, no visual changes.
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: