cron: Set environment variables to use Smokescreen, if configured.

This commit is contained in:
Alex Vandiver
2024-04-19 14:25:36 -04:00
committed by Tim Abbott
parent f355a08111
commit 572fafd6b9
3 changed files with 23 additions and 5 deletions

View File

@@ -24,8 +24,9 @@ class kandra::prod_app_frontend_once {
command => '/usr/lib/nagios/plugins/zulip_app_frontend/check_send_receive_time --site=https://$(/home/zulip/deployments/current/scripts/get-django-setting NAGIOS_BOT_HOST) >/dev/null',
}
zulip::cron { 'check_user_zephyr_mirror_liveness':
hour => '*',
minute => '*',
command => '/usr/lib/nagios/plugins/zulip_zephyr_mirror/check_user_zephyr_mirror_liveness >/dev/null',
hour => '*',
minute => '*',
command => '/usr/lib/nagios/plugins/zulip_zephyr_mirror/check_user_zephyr_mirror_liveness >/dev/null',
use_proxy => false,
}
}

View File

@@ -7,7 +7,20 @@ define zulip::cron(
String $user = 'zulip',
Optional[String] $command = undef,
Optional[String] $manage = undef,
Boolean $use_proxy = true,
) {
if $use_proxy {
$proxy_host = zulipconf('http_proxy', 'host', 'localhost')
$proxy_port = zulipconf('http_proxy', 'port', '4750')
if $proxy_host != '' and $proxy_port != '' {
$proxy = "http://${proxy_host}:${proxy_port}"
} else {
$proxy = ''
}
} else {
$pxoy = ''
}
$dsn = zulipconf('sentry', 'project_dsn', '')
if $dsn != '' {
include zulip::sentry_cli

View File

@@ -2,9 +2,13 @@ MAILTO=zulip
PATH=/usr/local/bin:/usr/bin:/bin
SHELL=/bin/bash
USER=<%= @user %>
<% if @dsn != '' %>
<% if @proxy != '' -%>
HTTP_proxy="<%= @proxy %>"
HTTPS_proxy="<%= @proxy %>"
<% end -%>
<% if @dsn != '' -%>
SENTRY_DSN=<%= @dsn %>
<% end %>
<% end -%>
<%= @minute %> <%= @hour %> * * <%= @dow %> <%= @user %> <%= @run %>