Ask Your Question

auto-execute subclasses

asked 2013-11-19 09:35:41 -0600

Arney gravatar image

I want to keep my site.pp lean like this:

node '' {
  include client

I would also like to keep init.pp lean:

class client {
  # Just example code from here
  file {'Delete PrePuppet maintenance':
    path    => '/etc/cron.weekly/sync',
    ensure  => absent,

And to keep a good overview, I would like to add each addition in its own file, for example like this:

class client::test {
  file {'testfile':
    path    => '/root/testfile', 
    ensure  => present,
    content => $architecture",

but this last one obviously ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-11-19 10:58:23 -0600

lavaman gravatar image

There is no mechanism built-in to execute subclasses. Modules are meant to be flexible and support writing modules in different ways depending on your needs. There's no way to know when it make sense to automatically execute subclasses, because they may not be intended to run in most cases. One of the more common examples of this is modules that have a ::disabled class that shuts down the service associated with that module.

If you want all your subclasses to run when you include the base class, you have to include or declare all your subclasses in your base class.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-11-19 09:35:41 -0600

Seen: 52 times

Last updated: Nov 19 '13