Pyoungmeister has submitted this change and it was merged.

Change subject: security fix for stat1 cron job
......................................................................


security fix for stat1 cron job

Change-Id: I1aa52fc55321e19fe400fee94d40ea88bb053ee6
---
M manifests/misc/statistics.pp
M templates/misc/email-blog-pageviews.erb
2 files changed, 6 insertions(+), 8 deletions(-)

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



diff --git a/manifests/misc/statistics.pp b/manifests/misc/statistics.pp
index 918725e..bb711dc 100644
--- a/manifests/misc/statistics.pp
+++ b/manifests/misc/statistics.pp
@@ -676,22 +676,19 @@
 # Sets up daily cron jobs to run a script which
 # groups blog pageviews by url and emails them
 class misc::statistics::cron_blog_pageviews {
+       $script = "/usr/local/bin/blog.sh"
+
        file {
-               "/usr/local/bin/blog.sh":
+               "$script":
                        mode    => 0755,
                        content => template("misc/email-blog-pageviews.erb");
-               "/home/dandreescu/blog_cron_output":
-                       ensure => "directory",
-                       owner  => "dandreescu",
-                       group  => "wikidev",
-                       mode   => 0755;
        }
 
        # Create a daily cron job to run the blog script
        # This requires that the $misc::statistics::user::username
        # user is installed on the source host.
        cron { "rsync_${name}_logs":
-               command => "/usr/local/bin/blog.sh",
+               command => "$script",
                user    => "$misc::statistics::user::username",
                hour    => 8,
                minute  => 0,
diff --git a/templates/misc/email-blog-pageviews.erb 
b/templates/misc/email-blog-pageviews.erb
index 481f660..143423c 100644
--- a/templates/misc/email-blog-pageviews.erb
+++ b/templates/misc/email-blog-pageviews.erb
@@ -1,7 +1,8 @@
 DATE=`date '+%Y-%m-%d'`;
-OUTPUT=/home/dandreescu/blog_cron_output/blog_$DATE.tsv
+OUTPUT=/tmp/blog_$DATE.tsv
 
 mysql log -h db1047.eqiad.wmnet -p<%= 
scope.lookupvar('passwords::mysql::research::password') %>
  -u<%= scope.lookupvar('passwords::mysql::research::user') %> -e "select 
count(event_requestUrl) as count, date(timestamp), event_requestUrl from 
WikimediaBlogVisit_5308166 where date(timestamp)=date('$DATE') group by 
event_requestUrl order by date(timestamp) desc, count desc;" > $OUTPUT
 
 cat $OUTPUT | mailx -s "Daily Blog Pageviews" [email protected]
+rm $OUTPUT

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1aa52fc55321e19fe400fee94d40ea88bb053ee6
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Milimetric <[email protected]>
Gerrit-Reviewer: Pyoungmeister <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to