On Dec 9, 6:27 am, Silviu Paragina <sil...@paragina.ro> wrote:
> 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".

As far as I know, overriding only works in a subclass, so it would
need to be:

class stripdown inherits mysql::server {
    Service { "mysqld": enable => "false", ensure => "stopped" }
}


Obviously, that's messy and it doesn't scale for multiple overrides.
It may also have other, unwanted effects.

> Or you may do it the other way around. (Include stripdown into
> mysql::server. (this probably the solution you want)

It would indeed make more sense for mysql::server to inherit stripdown
and override it, but again this does not scale.  If stripdown declares
any resources then I think you will get resource conflicts again if
you include multiple subclasses in the same manifest (e.g.
mysql::server and http::server, both inheriting stripdown).

> Or define a third skeleton class which starts with same bare
> definitions, and the other two override them

And in this case, the manifest needs to use a conditional to select
which subclass to include.  I think that's the best general approach,
but if you're going to do that then you don't need to subclass or
override anything.  Just have separate classes mysql::server and
mysql::server::disabled, and include exactly one, as appropriate.

Note also that any approach that forces mysqld to be disabled on
machines that aren't supposed to be mysql servers requires that mysql
nevertheless be *installed* on those machines.  Many admins would
argue that it shouldn't be present at all if it's not supposed to run.

--

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.


Reply via email to