mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
check_queue_worker_errors: Add support for running unprivileged.
Previously, this script needed access to Django settings, which in turn required access to /etc/zulip/zulip-secrets.conf. Since that isn't world-readable, this meant that this couldn't run as an unprivileged `nagios` user. Fix that by just hardcoding the appropriate path under /var/log/.
This commit is contained in:
@@ -7,13 +7,9 @@ import glob
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('/home/zulip/deployments/current')
|
# settings.QUEUE_ERROR_DIR; not importing Django so that this can run
|
||||||
import scripts.lib.setup_path_on_import
|
# as the nagios user.
|
||||||
|
wildcard = os.path.join("/var/log/zulip/queue_error", '*.errors')
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
wildcard = os.path.join(settings.QUEUE_ERROR_DIR, '*.errors')
|
|
||||||
clean = True
|
clean = True
|
||||||
for fn in glob.glob(wildcard):
|
for fn in glob.glob(wildcard):
|
||||||
print('WARNING: Queue errors logged in %s' % (fn,))
|
print('WARNING: Queue errors logged in %s' % (fn,))
|
||||||
|
|||||||
Reference in New Issue
Block a user