diff options
author | Micah Anderson <micah@riseup.net> | 2012-08-10 12:32:29 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2012-08-10 12:33:35 -0400 |
commit | 04d8317eb5b70aba62c2b18f6b1bd1d03aedeb5b (patch) | |
tree | 08e9f8444b1481e82a77a3170216cb93918886f8 | |
parent | 65af9e370b43b8959356d116f17607125a1f7733 (diff) |
Fix puppet attempting to change the puppet service from 'stopped' to running on each run:
notice: /Stage[main]/Puppet::Base/Service[puppet]/ensure: ensure changed 'stopped' to 'running'
When running in cron mode, you do not want the puppet service enabled, nor do
you want it 'running'. When enabling the cron mode, the first part of
puppet::cron::base does a Service override on the puppet service to set enable
=> false. That is a good thing, but all it does is make the service setup so it
wont be run on boot.
Unfortunately, the puppet service definition also has a 'ensure => running'
which does an /etc/init.d/puppet status and then starts the service if it is not
running. In a cron-only setup, the 'status' command results in a failure,
because the daemon is not running, and then puppet attempts to start it, which
goes nowhere because the /etc/default/puppet is configured not to start.
So, looking further at puppet::cron::base we see there is a case switch, testing
on operatingsystem and if its debian/ubuntu (or openbsd) it falls out of the
case. If it is not one of those, it continues and does a test to see if the
version of puppet is 2.6 and if so then it does an additional puppet Service
override to set ensure=> stopped which keeps the service from being checked to
see if it is running, and if it is not starting it.
So to fix this, we remove debian/ubuntu from the case, so it will continue
through and then we change the $puppet_majorversion test to look for anything
greater than or equal to '2.6', since 2.7 and later are also versions we want
this to work with.
After this change, we no longer get the attempt to restart puppet on every run.
-rw-r--r-- | manifests/cron/base.pp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 7daa6fb..5c7a708 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -6,12 +6,12 @@ class puppet::cron::base inherits puppet::base { } case $operatingsystem { - debian,openbsd,ubuntu: { + openbsd: { #it's already disabled } default: { $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion == '2.6' { + if $puppet_majorversion >= '2.6' { Service['puppet']{ ensure => stopped, } |