On May 9, 2008, at 1:20 PM, Marcin Owsiany wrote:

>
> Hi everyone,
>
> Here's a requirement I'm trying to meet:
>
>  No package installation should be attempted before "apt-get update"
>  runs. (Because it may need to pick up custom package repositories).
>  However I do not want to repeat:
>    requires => Exec["apt-get update"]
>  every time I create a package instance.
>
> Specifying
>  Package { require => Exec["apt-get update"] }
> at the top level does not work when you specify another "require"
> explicitly in some package instances.  You would have to either:
>
>  1) repeat the default every time a "require" is set explicitly.
>  Obviously, that is error-prone and violates the DRY principle.
>
>  2) use the +> operator instead of => but it seems to work only for
>  amending resources of inherited classes?
>
> So currently the only way to have this is to create a define.
>
> However
>
> - I'm reluctant to create one (since I was burnt by
>   http://reductivelabs.com/trac/puppet/ticket/446).
>
> - Even though this would probably work, (since #446 is now fixed), I
>   still feel that it may be good if puppet natively provided such
>   feature, without forcing nearly everyone to create their own, but
>   identical "my_package()".
>
>
> The idea would be to create some new syntax, which would work just  
> like:
>  File { require => blah }
> does, but make the "require" stick, instead of being replaced when you
> specify one explicitly.
>

I do this currently by making a definition for edge cases.  I use the  
Package default, and when I have a package that requires a certain  
situation I use a wrapper definition like:

define special::package(ensure = present, ... ) {
   package { $name: ensure => $ensure }
}

Now the require is a metaparam on the define, and all my other  
defaults work (I only define parameters that I don't use defaults for.

-Blake

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to