Ask Your Question
0

auto-execute subclasses

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

Arney gravatar image

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

#/etc/puppet/manifests/site.pp
node 'machine10.domain.com' {
  include client
}

I would also like to keep init.pp lean:

#/etc/puppet/modules/client/manifests/init.pp 
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:

#/etc/puppet/modules/client/manifests/test.pp
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
1

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

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

Stats

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

Seen: 43 times

Last updated: Nov 19 '13