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.

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

Alex Vandiver572fafd6b9cc
diff --git a/puppet/kandra/manifests/prod_app_frontend_once.pp b/puppet/kandra/manifests/prod_app_frontend_once.pp
index 25b4e21dddf..68767a97275 100644
--- a/puppet/kandra/manifests/prod_app_frontend_once.pp
+++ b/puppet/kandra/manifests/prod_app_frontend_once.pp
@@ -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,
}
}
diff --git a/puppet/zulip/manifests/cron.pp b/puppet/zulip/manifests/cron.pp
index 49f48555301..73803639511 100644
--- a/puppet/zulip/manifests/cron.pp
+++ b/puppet/zulip/manifests/cron.pp
@@ -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
diff --git a/puppet/zulip/templates/cron.template.erb b/puppet/zulip/templates/cron.template.erb
index a8dee5ebfe3..0c6fe9fa4e1 100644
--- a/puppet/zulip/templates/cron.template.erb
+++ b/puppet/zulip/templates/cron.template.erb
@@ -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 %>