Dzahn has submitted this change and it was merged.

Change subject: gerrit: puppetize reviewer-counts.json
......................................................................


gerrit: puppetize reviewer-counts.json

After putting the gerrit server role on new host cobalt,
we got some cronspam from this because the file it writes to
wasn't puppetized. It was fixed meanwhile but was still lacking
this to prevent it from happening again next time the role moves.

Bug: T147776
Change-Id: I0036971d2c57e7592b5848ac2cd5093fe1ba7f8e
---
M modules/gerrit/manifests/crons.pp
1 file changed, 9 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/gerrit/manifests/crons.pp 
b/modules/gerrit/manifests/crons.pp
index 198c0be..a1cfc18 100644
--- a/modules/gerrit/manifests/crons.pp
+++ b/modules/gerrit/manifests/crons.pp
@@ -7,12 +7,20 @@
         minute  => [0, 15, 30, 45],
     }
 
-    cron { 'list_reviewer_counts':
     # This is useful information about the distribution of reviewers.
     # Gerrit's rest api doesn't provide an easy way to get this data.
+    file { '/var/www/reviewer-counts.json':
+        ensure => 'present',
+        owner  => 'gerrit2',
+        group  => 'root',
+        mode   => '0644',
+    }
+
+    cron { 'list_reviewer_counts':
         command => "/usr/bin/java -jar 
/var/lib/gerrit2/review_site/bin/gerrit.war gsql -d 
/var/lib/gerrit2/review_site/ --format JSON_SINGLE -c 'SELECT changes.change_id 
AS change_id, COUNT(DISTINCT patch_set_approvals.account_id) AS reviewer_count 
FROM changes LEFT JOIN patch_set_approvals ON (changes.change_id = 
patch_set_approvals.change_id) GROUP BY changes.change_id' > 
/var/www/reviewer-counts.json",
         user    => 'gerrit2',
         hour    => 1,
+        require => File['/var/www/reviewer-counts.json'],
     }
 
     cron { 'clear_gerrit_logs':

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0036971d2c57e7592b5848ac2cd5093fe1ba7f8e
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to