On Sun, May 20, 2012 at 01:17:57PM +0200, Markus Falb wrote:
> Hi,
> I was thinking about a conceptual thing and I will try to explain with a
> concrete example.
> 
> In the puppetlabs-lvm module
> there is code like this in the logical_volume provider
> 
> if mount( '-f', '--guess-fstype', path) =~ /ext[34]/
>   resize2fs( path) || ...
> end
> 
> The resize2fs command is in the e2fsprogs package (well it is more
> complicated, but this is another topic), so this package has to be
> installed or an error will thrown.
> 
> I was thinking about how to ensure that the package is installed.
> I realize that I could do just
> 
> package { 'e2fsprogs': }
> logical_volume { 'bla':
>   fs_type => 'ext3',
>   require => Package['e2fsprogs']
> }
> 
> Is it possible to hide this dependency in the custom type?

The custom type "logical_volume" could specify an autorequire:

in logical_volume.rb:

    autorequire(:package) do
      'e2fsprogs'
    end

This way every logical_volume will depend on Package['e2fsprogs'] but
only if such a package is present in the catalog.

But what version of puppet are you using? Not sure if

    http://projects.puppetlabs.com/issues/6907

already covers your case.

-Stefan

-- 
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