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

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

Issue 29409691: Noissue - Void nginx $restart_command after package upgrade (Closed)
Patch Set: Created April 11, 2017, 3:51 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/nginx/manifests/init.pp
diff --git a/modules/nginx/manifests/init.pp b/modules/nginx/manifests/init.pp
index e5596f8feb2f4cd7b785fa6abe3590b35ba99571..ee186ed7dea62754b4b27456aa8cad0154be9271 100644
--- a/modules/nginx/manifests/init.pp
+++ b/modules/nginx/manifests/init.pp
@@ -220,11 +220,13 @@ class nginx (
}
$restart_command = join([
+ 'rm /tmp/nginx-restart-lock 2>/dev/null || (',
'set -e',
'pid=`cat /var/run/nginx.pid`',
'kill -USR2 "$pid"',
'sleep 2',
'kill -QUIT "$pid"',
+ ')',
], "\n")
service {'nginx':
@@ -243,4 +245,22 @@ class nginx (
require => Package['nginx'],
source => 'puppet:///modules/nginx/50x.html',
}
+
+ # This little hack is required to ensure the $restart_command being voided
+ # when the package is upgraded or installed for the first time, in which case
+ # the package maintainer's scripts would conflict with the Puppet resources,
+ # terminating both new and old processes (see http://hub.eyeo.com/issues/408)
+ exec {'nginx-update-hook':
+ before => Service['nginx'],
+ command => '/usr/bin/env touch /tmp/nginx-restart-lock',
+ refreshonly => true,
+ subscribe => Package['nginx'],
+ }
+
+ # The package does not know about the lock file, hence it is required to
+ # manually ensure the file being absent afterwards, for the next run
+ file {'/tmp/nginx-restart-lock':
+ ensure => 'absent',
+ require => Service['nginx'],
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld