On 09.12.2009 11:44, Alexandre wrote: > The use case i try to illustrate is when to declare some item (eq > mysqld service) with a default configuration that could be included on > every node (class stripdown in the example, for basenode), and still > be able to override this same item in some specific class (eg > mysql::server), to be included by specific nodes (eg myserver.local) > > I illustrated this use case with the example below. But of course, > Puppet parsing fails because the Service[mysql] is included twice. And > of course, class mysql::server > > Is there a way to override the Service["mysql"], or mark it as the > main one, or whatever ? > I was thinking about the virtual items and the realize function, but > it only permits apply an item multiple times, not to redefine or > override. > > class stripdown { > service {"mysql": enable => "false", ensure => "stopped" } > } > Not tested but it should be like
class stripdown { include mysql::server *S*ervice {"mysql": enable => "false", ensure => "stopped" } } Check the language tutorial for overriding. Note that is a big "S" not a small "s". Or you may do it the other way around. (Include stripdown into mysql::server. (this probably the solution you want) Or define a third skeleton class which starts with same bare definitions, and the other two override them Silviu > class mysql::server { > service { mysqld: > enable => true, > ensure => running, > hasrestart => true, > hasstatus => true, > path => "/etc/init.d/mysql", > require => Package["mysql-server"], > } > } > > node basenode { > include stripdown > } > > node myserver.local inherits basenode { > include mysql::server #<- boom, fails here > because of Service["mysql"] redefinition > } > > -- > > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-us...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.