cron subclass not working

18 views
Skip to first unread message

Tony Davis

unread,
Apr 26, 2016, 10:38:24 AM4/26/16
to Puppet Users
Hi, I'm fairly new to puppet but I've been trying to create some puppet modules to help me maintain my various PCs/laptops at home. I have created the following module:

my module init.pp contains

class bleachbit {
include bleachbit::install
include bleachbit::cronadd
}

install.pp has

class bleachbit::install {
package { 'bleachbit':
ensure => installed,
notify => Cronadd['bleachbit'],
}
}

cronadd.pp has

class bleachbit::cronadd {
cron { 'bleachbit':
ensure => present,
command => '/usr/bin/bleachbit',
user => 'root',
weekday => '*',
minute => '10',
hour => '11',
subscribe => Package['bleachbit'],
}
}

site.pp has

node 'Microserver' {
include bleachbit
include testfile
}

when I run "puppet apply manifests" bleachbit is installed fine but the cronadd subclass is completely ignored. I have checked the syntax with puppet-lint
and it seems fine. Also, if create cronadd as a separate module, it works fine.

I don't understand what the problem is. Running with --debug gives no clues.

Thanks!
 




jcbollinger

unread,
Apr 27, 2016, 9:41:01 AM4/27/16
to Puppet Users


That seems surprising.  Indeed, very surprising.  If Puppet's catalog builder sees an 'include' statement naming a class that it cannot find, then it will error out.  As a result, I'm inclined to think that there is some sort of confusion about which file is where.  In particular, I suspect that you have multiple versions of class bleachbit floating around, and the one Puppet chooses is not the one you've presented.

 
 I have checked the syntax with puppet-lint
and it seems fine. Also, if create cronadd as a separate module, it works fine.



I'm not sure off-hand whether I should expect puppet-lint to catch it, but the class bleachbit::install that you presented is broken.  It contains a resource reference to a non-existent resource,
Cronadd['bleachbit']. I suspect you meant Class['cronadd::bleachbit'] there.  The manifest set you presented would not be accepted by the catalog builder.

I don't understand what the problem is. Running with --debug gives no clues.



And I don't think you've given us enough clues to really nail down an answer, but if 'puppet apply --debug' truly issues no complaints then it cannot be operating on the manifest set you presented.  That could certainly create some confusion.


John

Tony Davis

unread,
Apr 28, 2016, 4:00:44 AM4/28/16
to Puppet Users
Thank you John, You were of course correct, I did have another bleachbit module floating around. After I initially installed puppet, bumbling around not really knowing what I was doing, I started to work in the /home/tony/.puppetlabs area. Later, can't remember why now, I switched to /etc/puppetlabs. However, I'd left a bleachbit module behind and as /home/tony/.puppetlabs was first in the modulepath, it was using that version and quite legitimately ignoring my new version.

Also I tided up the notify statement (actually I only just added the notify bit as I thought it may a dependency issue and didn't run that particular version against puppet-lint so I expect that would have got picked up).

Thanks again. Seems obvious now but I guess when you're working on something new, it's easy to get confused. Anyway, one good thing, I learnt quite a lot trying to troubleshoot the problem!! I'll stop waffling now....
Reply all
Reply to author
Forward
0 new messages