Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

process_fts_updates: Nagios may lack permissions to load Django config.

Alex Vandiver0645656fd8d4
diff --git a/puppet/zulip/files/postgresql/process_fts_updates b/puppet/zulip/files/postgresql/process_fts_updates
index ac2946474d2..722307c7761 100755
--- a/puppet/zulip/files/postgresql/process_fts_updates
+++ b/puppet/zulip/files/postgresql/process_fts_updates
@@ -29,6 +29,10 @@
# however, we wish to import `zerver.settings` since we have no
# /etc/zulip/zulip.conf to read, and that case _requires_ loading the
# venv.
+#
+# We also must handle the cases where we are run as the `nagios` user,
+# which may not have permission to read all configuration files, and
+# thus (2) will look like (3).
import argparse
import configparser
@@ -134,7 +138,7 @@ try:
pg_args["sslmode"] = settings.DATABASES["default"]["OPTIONS"].get("sslmode")
pg_args["connect_timeout"] = "600"
USING_PGROONGA = settings.USING_PGROONGA
-except ImportError:
+except (ImportError, PermissionError):
# Case (3): we know that the PostgreSQL server is on this host.
pg_args["user"] = "zulip"