From c5a275505bf2aafb9378d923985f9915e81ce7a7 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 9 Aug 2012 16:03:01 -0400 Subject: fix puppetmaster service definition for passenger Because passenger mode doesn't have its own daemon, it was a hack before to have the service definition for 'puppetmaster' be actually looking in the process list for 'apache2'. This sort of worked, but not if you need to notify the service for a restart. It also didn't actually work, because the hasstatus parameter was set to true, which meant that on every run, puppet did a /etc/init.d/puppetmaster status and found that it was not running and then tried to start it by doing /etc/init.d/puppetmaster start. That doesn't work because its turned off in /etc/default/puppetmaster when puppetmaster_mode='passenger'. So... this commit removes that hacky service definition and instead just requires the apache::base class, providing the apache service monitoring that is needed when you are running puppetmaster_mode='passenger'. It also has to pull up the Service[puppet] override which was adding the puppetmaster service, which makes no sense because there is no service. Finally, in order to notify it for changes, we need to use a selector to determine how to reload things based on puppetmaster_mode. Conflicts: manifests/puppetmaster/linux.pp --- manifests/puppetmaster/debian.pp | 5 ++++- manifests/puppetmaster/linux.pp | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/manifests/puppetmaster/debian.pp b/manifests/puppetmaster/debian.pp index 8cee0ea..853a0e6 100644 --- a/manifests/puppetmaster/debian.pp +++ b/manifests/puppetmaster/debian.pp @@ -13,7 +13,10 @@ class puppet::puppetmaster::debian inherits puppet::puppetmaster::package { "puppet:///modules/site-puppet/master/debian/${domain}/puppetmaster", "puppet:///modules/site-puppet/master/debian/puppetmaster", "puppet:///modules/puppet/master/debian/puppetmaster" ], - notify => Service[puppetmaster], + notify => $puppetmaster_mode ? { + 'passenger' => Exec['notify_passenger_puppetmaster'], + default => Service[puppetmaster], + }, owner => root, group => 0, mode => 0644; } } diff --git a/manifests/puppetmaster/linux.pp b/manifests/puppetmaster/linux.pp index 2670203..5cde0c3 100644 --- a/manifests/puppetmaster/linux.pp +++ b/manifests/puppetmaster/linux.pp @@ -1,6 +1,9 @@ class puppet::puppetmaster::linux inherits puppet::linux { if $puppetmaster_mode == 'passenger' { + + require('apache::base') + exec { 'notify_passenger_puppetmaster': refreshonly => true, command => 'touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && rm /etc/puppet/rack/tmp/restart.txt', @@ -11,8 +14,8 @@ class puppet::puppetmaster::linux inherits puppet::linux { enable => true, require => [ Package[puppet] ], } - } - Service[puppet]{ - require +> Service[puppetmaster], + Service[puppet]{ + require +> Service[puppetmaster], + } } } -- cgit v1.2.3