2012/2/15 jcbollinger <[email protected]>

>
>
> On Feb 14, 10:41 am, Nan Liu <[email protected]> wrote:
> > On Tue, Feb 14, 2012 at 6:49 AM, ruslan usifov <[email protected]>
> 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



> It looks like what you're really looking for is class composition, and
> that's exactly the solution that Nan proposed to you.  Do not use
> inheritance to achieve composition.
>
>
> > It's not currently possible, and I don't know if it's 100% clear when
> > you inherit and add parameters do you intend inherit the parent's
> > default, override the parent's default, or to pass new parameters.
>
>
> And this is one of the lesser reasons to avoid parameterizing your
> classes.
>
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to