Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
checks: Call out required settings still set to the example values.
Alex Vandiver14d88e9ece99
diff --git a/zerver/checks.py b/zerver/checks.pyindex aaf2ccbc385..cc7311b9a1e 100644--- a/zerver/checks.py+++ b/zerver/checks.py@@ -27,11 +27,8 @@ def check_required_settings(]errors = []for setting_name, default in required_settings:- if (- hasattr(settings, setting_name)- and getattr(settings, setting_name) != default- and getattr(settings, setting_name)- ):+ value = getattr(settings, setting_name, None)+ if value and value != default:continueif settings.RUNNING_IN_HELM:@@ -43,9 +40,19 @@ def check_required_settings(else:settings_location = "/etc/zulip/settings.py"setting_display_name = setting_name+ if value:+ # The setting is still the example value from the+ # documentation, which the admin must replace -- saying+ # "you must set" it would be confusing, as it is set.+ message = (+ f"{setting_display_name} is still set to the example value {default!r}; "+ f"change it in {settings_location}"+ )+ else:+ message = f"You must set {setting_display_name} in {settings_location}"errors.append(checks.Error(- f"You must set {setting_display_name} in {settings_location}",+ message,obj=f"settings.{setting_name}",id="zulip.E001",)diff --git a/zerver/tests/test_checks.py b/zerver/tests/test_checks.pyindex 953cba9082e..b50c9e6771b 100644--- a/zerver/tests/test_checks.py+++ b/zerver/tests/test_checks.py@@ -34,7 +34,8 @@ class TestChecks(ZulipTestCase):@override_settings(RUNNING_IN_DOCKER=False)def test_checks_required_setting(self) -> None:self.assert_check_with_error(- "(zulip.E001) You must set ZULIP_ADMINISTRATOR in /etc/zulip/settings.py",+ "(zulip.E001) ZULIP_ADMINISTRATOR is still set to the example value "+ "'[email protected]'; change it in /etc/zulip/settings.py",ZULIP_ADMINISTRATOR="[email protected]",)@@ -51,7 +52,8 @@ class TestChecks(ZulipTestCase):@override_settings(RUNNING_IN_DOCKER=True)def test_checks_required_setting_docker(self) -> None:self.assert_check_with_error(- "(zulip.E001) You must set SETTING_ZULIP_ADMINISTRATOR in your Docker environment configuration",+ "(zulip.E001) SETTING_ZULIP_ADMINISTRATOR is still set to the example value "+ "'[email protected]'; change it in your Docker environment configuration",ZULIP_ADMINISTRATOR="[email protected]",)@@ -68,7 +70,8 @@ class TestChecks(ZulipTestCase):@override_settings(RUNNING_IN_DOCKER=True, RUNNING_IN_HELM=True)def test_checks_required_setting_helm(self) -> None:self.assert_check_with_error(- "(zulip.E001) You must set zulip.environment.SETTING_ZULIP_ADMINISTRATOR in your Helm values",+ "(zulip.E001) zulip.environment.SETTING_ZULIP_ADMINISTRATOR is still set to "+ "the example value '[email protected]'; change it in your Helm values",ZULIP_ADMINISTRATOR="[email protected]",)