On 01/31/2010 01:44 PM, Dan Bode wrote:
> 
> 
> On Fri, Jan 29, 2010 at 9:58 AM, Doug Warner <d...@warner.fm
> <mailto:d...@warner.fm>> wrote:
> 
>     Running puppet 0.24.8, I'd like to make Puppet be indifferent/ignore
>     whether a
>     package is installed or not.  The hangup here is that I include a
>     class that
>     installs the package, so I through to make a class that inherits
>     that and
>     changes ensure => undef, but this doesn't seem to work.  I have
>     something like
>     this:
> 
> 
> what you are describing below works: including an inherited class
> together with its parent and expecting the resources to be overridden
> correctly.
> 
> I think the problem is that the default behavior for package when ensure
> => undef is for it to install the package. Changing this behavior could
> be an interesting feature request.
>  
> you could use if(defined(Class['child'])) in the parent to determine if
> the package resource should be declared. This is pretty hacky though, I
> would consider remodeling your base class instead since this package
> resource does not belong there.

I forgot to mention that I've tried "ensure => absent" in my child class but
the package still seems to get installed.

This is really a hack to get this package excluded temporarily while we work
out a packaging bug, so I don't mind hacks like you suggested.

Maybe the problem is that my example was too simplistic?  My actually classes
have the "disabled" child class as a 3rd-level child, like so:

class PkgGroup {}
class PkgGroup::InstallPkg inherits PkgGroup {
  package { coolpkg: ensure => latest, }
}
class PkgGroup::InstallPkg::disabled inherits PkgGroup::InstallPkg {
  Package['coolpkg'] { ensure => absent, }
}

-Doug

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to