On Feb 17, 3:48 am, ruslan usifov <ruslan.usi...@gmail.com> wrote: > 2012/2/15 jcbollinger <john.bollin...@stjude.org> > > > > > On Feb 14, 10:41 am, Nan Liu <n...@puppetlabs.com> wrote: > > > On Tue, Feb 14, 2012 at 6:49 AM, ruslan usifov <ruslan.usi...@gmail.com> > > wrote: > > > > Hello > > > > > In is possible inherits from parametrized class?? > > > Is class inheritance really would you should be using? If your > > intention is for the child class to override properties of resources > > declared by the parent class, then yes; otherwise no. From your > > example it appears no resource overriding is intended, so probably > > "no". > > I think yes, for example i use in linux::php52, follow service definition > > service > { > "php-fpm": > require => [ File["/usr/local/etc/php-fpm.conf"], Package["php52"], > File["/var/log/php-fpm/"], File["/etc/init.d/php-fpm"] ]; > > } > > and in derived class i want for standalone(linux::php52::standalone) > configuration restart service when config files changed like this: > > Service["php-fpm"] > { > ensure => true, > enable => true, > hasrestart => true, > subscribe => [ File["/usr/local/etc/php-fpm.conf"], > File["/usr/local/etc/php.ini"], File["/etc/init.d/php-fpm"], > Package["php52"] ]; > > } > > and in cluster class do nothing(restart of php will be made by cluster > stack) like this: > > Service["php-fpm"] > { > enable => false > > } > > How cant accomplish this be composition? I would be very grateful
If no node uses linux::php52 directly (every node uses either linux::php52::standalone or linux::php52::cluster) then just remove the service declaration from linux::php52 and put separate ones in linux::php52::standalone and linux::php52::cluster. That makes especial sense in this example because the two erstwhile subclasses don't need any Service["php-fpm"] property values in common: the "require" property they both inherit is redundant with the "subscribe" property that the standalone class provides. Class inheritance is a convenience in certain special circumstances, but only a complication in most. You don't ever need it in any absolute sense. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@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.