Dzahn has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372463 )

Change subject: phabricator: Only send logmail on prod not labs, pt.2
......................................................................

phabricator: Only send logmail on prod not labs, pt.2

follow-up to Iec8fb20db413f to ensure logmail is only sent
from a prod host that has it explicitly enabled in Hiera,
to avoid duplicate mails/spam to lists from standby/test/labs.

But unlike before make it a separate thing from "active_server".

Use a puppet selector instead of if/else.

Bug: T173297
Change-Id: I4b010fb9a4985626a3846d31b476028c4b4ae7c3
---
M modules/profile/manifests/phabricator/main.pp
1 file changed, 26 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/63/372463/1

diff --git a/modules/profile/manifests/phabricator/main.pp 
b/modules/profile/manifests/phabricator/main.pp
index bd1ac9c..d11570b 100644
--- a/modules/profile/manifests/phabricator/main.pp
+++ b/modules/profile/manifests/phabricator/main.pp
@@ -29,18 +29,23 @@
     include passwords::phabricator
     include passwords::mysql::phabricator
 
-    # logmail and dumps are only enabled on the active server set in Hiera
+    # dumps are only enabled on the active server set in Hiera
     $phabricator_active_server = hiera('phabricator_active_server')
     if $::hostname == $phabricator_active_server {
-        $logmail_ensure = 'present'
         $dump_rsync_ensure = 'present'
         $dump_enabled = true
         $ferm_ensure = 'present'
     } else {
-        $logmail_ensure = 'absent'
         $dump_rsync_ensure ='absent'
         $dump_enabled = false
         $ferm_ensure = 'absent'
+    }
+
+    # logmail must be explictly enabled in Hiera with 'phabricator_logmail: 
true'
+    # to avoid duplicate mails from labs and standby (T173297)
+    $logmail_ensure = $logmail ? {
+        true    => 'present',
+        default => 'absent',
     }
 
     # todo: change the password for app_user
@@ -156,8 +161,6 @@
         conf_files     => $conf_files,
     }
     # lint:endignore
-
-
 
     # This exists to offer git services at git-ssh.wikimedia.org
     $vcs_ip_v4 = hiera('phabricator::vcs::address::v4', undef)
@@ -275,27 +278,25 @@
         require     => Package[$deploy_target],
     }
 
-    if $logmail {
-      # community metrics mail (T81784, T1003)
-      phabricator::logmail {'communitymetrics':
-          ensure       => $logmail_ensure,
-          script_name  => 'community_metrics.sh',
-          rcpt_address => 'wikitec...@lists.wikimedia.org',
-          sndr_address => 'communitymetr...@wikimedia.org',
-          monthday     => '1',
-          require      => Package[$deploy_target],
-      }
+    # community metrics mail (T81784, T1003)
+    phabricator::logmail {'communitymetrics':
+        ensure       => $logmail_ensure,
+        script_name  => 'community_metrics.sh',
+        rcpt_address => 'wikitec...@lists.wikimedia.org',
+        sndr_address => 'communitymetr...@wikimedia.org',
+        monthday     => '1',
+        require      => Package[$deploy_target],
+    }
 
-      # project changes mail (T85183)
-      phabricator::logmail {'projectchanges':
-          ensure       => $logmail_ensure,
-          script_name  => 'project_changes.sh',
-          rcpt_address => [ 'phabricator-repo...@lists.wikimedia.org' ],
-          sndr_address => 'aklap...@wikimedia.org',
-          monthday     => '*',
-          weekday      => 1, # Monday
-          require      => Package[$deploy_target],
-      }
+    # project changes mail (T85183)
+    phabricator::logmail {'projectchanges':
+        ensure       => $logmail_ensure,
+        script_name  => 'project_changes.sh',
+        rcpt_address => [ 'phabricator-repo...@lists.wikimedia.org' ],
+        sndr_address => 'aklap...@wikimedia.org',
+        monthday     => '*',
+        weekday      => 1, # Monday
+       require       => Package[$deploy_target],
     }
 
     if $active_server != undef {

-- 
To view, visit https://gerrit.wikimedia.org/r/372463
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b010fb9a4985626a3846d31b476028c4b4ae7c3
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <dz...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to