Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/notificationserver/manifests/init.pp

Issue 29557718: #3927 - Clear Nginx cache when notifications are updated (Closed)
Patch Set: Created Sept. 27, 2017, 4:37 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/notificationserver/manifests/init.pp
diff --git a/modules/notificationserver/manifests/init.pp b/modules/notificationserver/manifests/init.pp
index 1d7eaf21f3a8602783bf6a8078647c6cd5a6cfa6..235d64a2cb80569b1eb5ed20da5be536d707676f 100644
--- a/modules/notificationserver/manifests/init.pp
+++ b/modules/notificationserver/manifests/init.pp
@@ -16,6 +16,25 @@ class notificationserver($is_default = false) {
onlyif => 'test ! -d /opt/notifications'
}
+ # http://hub.eyeo.com/issues/3927
+ $clear_cache = "find /var/cache/nginx/notification -type f -exec rm -rf {} +"
+
+ # https://linux.die.net/man/5/sudoers
+ file {"/etc/sudoers.d/notification-cache":
+ content => "nginx ALL=(www-data) NOPASSWD:/usr/bin/$clear_cache\n",
f.nicolaisen 2017/09/28 11:05:25 Consider extracting 'www-data' here and below to m
mathias 2017/09/28 12:00:00 Acknowledged.
+ ensure => 'present',
+ group => 'root',
+ mode => '0440',
+ owner => 'root',
+ }
+
+ # https://docs.puppet.com/puppet/latest/types/augeas.html
+ augeas {"files/opt/notifications/.hg/hgrc/hooks/cache":
+ changes => ["set hooks/changegroup.cache 'sudo -u www-data $clear_cache'"],
+ incl => '/opt/notifications/.hg/hgrc',
f.nicolaisen 2017/09/28 11:05:25 No dependency on the notifications repo having bee
mathias 2017/09/28 12:00:00 Acknowledged. Interestingly we just recently lear
+ lens => "Puppet.lns",
+ }
+
cron {'update_notifications':
command => 'hg pull -q -u -R /opt/notifications',
environment => hiera('cron::environment', []),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld