Commit 24cf7ab31aef05151f84e08a9c088455e4f3660c
Exists in
master
and in
26 other branches
Merge branch 'disable_email_dev' into 'master'
Disable email dev Adicionamos uma verificação para não enviar email dos ambientes de dev. - Via postconf alteramos o arquivo main.cf para escrever os emails em /var/tmp/fs_mail.dump - Criamos um template master.cf.development para ambientes que não forem de produção; See merge request !135
Showing
3 changed files
with
17 additions
and
1 deletions
Show diff stats
config/dev/config.yaml
| @@ -20,3 +20,4 @@ external_outgoing_mail_domain: serpro.gov.br | @@ -20,3 +20,4 @@ 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 | dev_backup_frequency: true | 22 | dev_backup_frequency: true |
| 23 | +disable_send_emails: true |
cookbooks/mailman/files/centos/master.cf
| @@ -122,7 +122,12 @@ scache unix - - n - 1 scache | @@ -122,7 +122,12 @@ scache unix - - n - 1 scache | ||
| 122 | #scalemail-backend unix - n n - 2 pipe | 122 | #scalemail-backend unix - n n - 2 pipe |
| 123 | # flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store | 123 | # flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store |
| 124 | # ${nexthop} ${user} ${extension} | 124 | # ${nexthop} ${user} ${extension} |
| 125 | -# | 125 | + |
| 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,6 +83,16 @@ cookbook_file '/etc/cron.d/mailman-spb' do | @@ -83,6 +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-send-emails' do | ||
| 87 | + command "postconf 'default_transport = fs_mail'" | ||
| 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']}" | ||
| 94 | +end | ||
| 95 | + | ||
| 86 | cookbook_file '/etc/postfix/master.cf' do | 96 | cookbook_file '/etc/postfix/master.cf' do |
| 87 | notifies :reload, 'service[postfix]' | 97 | notifies :reload, 'service[postfix]' |
| 88 | end | 98 | end |