Commit 4fa4749ceecb4a13dc8e9d510968ccc1bb63fc55
1 parent
53470c08
Exists in
disable_email_dev
Defines variable to write mailman's emails in file
Showing
3 changed files
with
14 additions
and
8 deletions
Show diff stats
config/dev/config.yaml
@@ -19,3 +19,4 @@ alt_ssh_port: 55555 | @@ -19,3 +19,4 @@ alt_ssh_port: 55555 | ||
19 | external_outgoing_mail_domain: serpro.gov.br | 19 | external_outgoing_mail_domain: serpro.gov.br |
20 | raven_dsn: https://a5e2f92a83774dfc9de66486e0fe970b:1a9229a4e1d2483582144d302fb53115@sentry.tracy.com.br/19 | 20 | raven_dsn: https://a5e2f92a83774dfc9de66486e0fe970b:1a9229a4e1d2483582144d302fb53115@sentry.tracy.com.br/19 |
21 | google_analytics_id: 'UA-64206731-2' | 21 | google_analytics_id: 'UA-64206731-2' |
22 | +disable_send_emails: true |
cookbooks/mailman/files/centos/master.cf
@@ -126,3 +126,8 @@ scache unix - - n - 1 scache | @@ -126,3 +126,8 @@ scache unix - - n - 1 scache | ||
126 | mailman unix - n n - - pipe | 126 | mailman unix - n n - - pipe |
127 | flags=FR user=mailman:mailman argv=/usr/lib/mailman/bin/postfix-to-mailman.py | 127 | flags=FR user=mailman:mailman argv=/usr/lib/mailman/bin/postfix-to-mailman.py |
128 | ${nexthop} ${user} | 128 | ${nexthop} ${user} |
129 | + | ||
130 | +fs_mail unix - n n - - pipe | ||
131 | + flags=F user=spb argv=tee --append /var/tmp/fs_mail.dump | ||
132 | + | ||
133 | + |
cookbooks/mailman/recipes/default.rb
@@ -83,16 +83,16 @@ cookbook_file '/etc/cron.d/mailman-spb' do | @@ -83,16 +83,16 @@ cookbook_file '/etc/cron.d/mailman-spb' do | ||
83 | mode 0644 | 83 | mode 0644 |
84 | end | 84 | end |
85 | 85 | ||
86 | -execute 'postfix:disable-email-prod' do | 86 | +execute 'postfix:disable-send-emails' do |
87 | command "postconf 'default_transport = fs_mail'" | 87 | command "postconf 'default_transport = fs_mail'" |
88 | - not_if "cat /etc/postfix/main.cf | grep 'default_transport = fs_mail'" | ||
89 | - action :nothing | 88 | + only_if "#{node['config']['disable_send_emails']}" |
89 | +end | ||
90 | + | ||
91 | +execute 'postfix:enable-send-emails' do | ||
92 | + command "postconf 'default_transport = smtp'" | ||
93 | + not_if "#{node['config']['disable_send_emails']}" | ||
90 | end | 94 | end |
91 | 95 | ||
92 | cookbook_file '/etc/postfix/master.cf' do | 96 | cookbook_file '/etc/postfix/master.cf' do |
93 | - unless node['environment'] == "prod" | ||
94 | - source 'master.cf.development' | ||
95 | - notifies :run, 'execute[postfix:disable-email-prod]' | ||
96 | - end | ||
97 | - notifies :restart, 'service[postfix]' | 97 | + notifies :reload, 'service[postfix]' |
98 | end | 98 | end |