mirror of https://github.com/zulip/zulip.git
process_fts_updates: Nagios may lack permissions to load Django config.
Even if Django and PostgreSQL are on the same host, the `nagios` user may lack permissions to read accessory configuration files needed to load the Django configuration (e.g. authentication keys). Catch those failures, and switch to loading the required settings from `/etc/zulip/zulip.conf`.
This commit is contained in:
parent
a35af3f38b
commit
0645656fd8
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue