Hi,

The example is just there to show the duplicate problem that i don't
understand as i use a virtual ressource.

Here is another one:

define mydefine1 {
 @file{ "/$name": ensure => directory }
}

define mydefine2($dir) {
 mydefine1 { $dir: }

 realize File["/$dir"]

 file{ "/$dir/$name": ensure => directory }
}

mydefine2 { test1: dir => test}
mydefine2 { test2: dir => test}

I've got a lot of mydefine2 to declare. Sure a workaround would be to
add all the mydefine1 declarations in one single class and remove it
from mydefine2 but i find it's not an elegant solution.

2010/1/12 jcbollinger <john.bollin...@stjude.org>:
>
>
> On Jan 11, 3:41 pm, Sébastien Prud'homme
> <sebastien.prudho...@gmail.com> wrote:
>> Thanks for the responses. My example is just an example. My real
>> "define" has some parameters so it's not possible to use a class.
>
> Whether 'mydefine1' has parameters is irrelevant to whether you can
> achieve your configuration goal by putting the package declaration
> into a class.
>
> Are you trying to say that the parameters to 'mydefine1' are used to
> set properties of the Package resource?  That cannot work if
> 'mydefine1' is called more than once with different parameters.
> Resources describe the desired state of the system, so it doesn't even
> make sense to declare the same resource differently in different parts
> of the same catalog.  It is impossible to accommodate multiple
> different specifications, because a resource can have only one state
> at a time.
>
> On the other hand, if the parameters for the package will be the same
> every time 'mydefine1' is called within each given node's catalog,
> then you definitely can put the package declaration (virtual or not)
> into a class.  You don't have to convert 'mydefine1' into a class, as
> our examples show: you can put the package into an existing class if
> there's a suitable one, or you can create a new class for it, as in
> the example.  It is still quite possible to customize the package's
> parameters for each node.
>
> You may need to rearrange your manifests more than you hoped before
> they work, but there is no avoiding the prohibition against multiple
> declarations of the same resource.  We may be able to provide better
> help if you are more specific about what you're trying to do.
>
> --
> 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.
>
>
>
>
-- 
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