Skip to content

Commit 73627e8

Browse files
committed
cms: Omit "root" from cron MAILTO, like for other services. Use Jinja filters instead of str methods. Use new "cron" key ("context" is passed to php-fpm templates).
1 parent 1621642 commit 73627e8

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

pillar/coalition.sls

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ phpfpm:
2323
configuration: default
2424
context:
2525
user: coalition
26-
cron_contact:
27-
- sysadmin@open-contracting.org
28-
- root
29-
cron_ignore:
30-
- a-fake-plugin.php
3126
listen_user: www-data
3227
socket: /var/run/php/php-fpm-coalition.sock
28+
cron:
29+
contact:
30+
- sysadmin@open-contracting.org
31+
ignore:
32+
- a-fake-plugin.php

pillar/corporate.sls

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ phpfpm:
3030
configuration: default
3131
context:
3232
user: corporate
33-
cron_contact:
34-
- sysadmin@open-contracting.org
35-
- support+ocp@theideabureau.co
36-
- root
3733
listen_user: www-data
3834
socket: /var/run/php/php-fpm-corporate.sock
3935
env:
4036
# Increased to resolve WordPress menu issue.
4137
php_value[max_input_vars]: 2000
38+
cron:
39+
contact:
40+
- sysadmin@open-contracting.org
41+
- support+ocp@theideabureau.co
4242

4343
ssh:
4444
corporate:

salt/cms/init.sls

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ allow {{ userdir }} access:
3434
- require:
3535
- user: {{ user }}_user_exists
3636
37-
{{ set_cron_env(user, 'MAILTO', ','.join(entry.context.cron_contact | default(['root']) ), 'cms' ) }}
37+
{{ set_cron_env(user, 'MAILTO', entry.cron.contact|join(','), 'cms' ) }}
3838
3939
# Assumes that all PHP-FPM sites on the CMS server are WordPress.
40-
{% if entry.context.cron_ignore is defined %}
41-
/usr/local/bin/wp cron event run --quiet --due-now --path={{ userdir }}/public_html 2>&1 | grep -v '{{ '\|'.join(entry.context.cron_ignore) }}':
42-
{% else %}
43-
/usr/local/bin/wp cron event run --quiet --due-now --path={{ userdir }}/public_html:
44-
{% endif %}
40+
41+
/usr/local/bin/wp cron event run --quiet --due-now --path={{ userdir }}/public_html{% if 'ignore' in entry.cron %} 2>&1 | grep -v '{{ entry.cron.ignore|join('\|') }}'{% endif %}:
4542
cron.present:
4643
- identifier: WORDPRESS_SITE_CRON
4744
- user: {{ user }}

0 commit comments

Comments
 (0)