On Sep 16, 2010, at 12:07 PM, R.I.Pienaar wrote:
> 'lo,
>
> I've been toying with parametrized classes and have a question.
>
> Given this manifest:
>
> class foo($message) {
> notify{$message: }
> }
>
> class{"foo": message => "hello world"}
>
>
> I can only have the last line once, a 2nd time the same causes duplicate
> resource warnings. How are these classes different from defines in this
> case? Is the intention that we only ever 'include' such a class once and
> this makes them different from defines?
>
> I recall early on some discussion that suggested you could do multiple of
> these new style include things but that the 'first' one will win as such
> since classes are still singletons, so I am not really sure here what the
> utility of these would be, what they bring to the table as they are today?
In truth, parameterized classes are of limited use until the external nodes
interfaces support passing class and parameter information directly. That is,
if a Node object retrieved from Dashboard contained class resources, then this
becomes intuitive and useful, but sticking to specifying class resources in the
code is a bit clumsy, for exactly the reasons you specify.
Essentially, yes - the same exact rules apply to class resources as to other
resources, in terms of duplication. The only difference is that you can do
this:
class { "foo": message => foo }
include foo
include foo
I.e., you can include the class as many times as you want (because include is a
noop when the class is already included), but you can only specify the full
resource once. No, this isn't all that useful, but if you're using 'include'
to essentially just specify a dependency, this can work.
--
The Internet, of course, is more than just a place to find pictures of
people having sex with dogs. -- Time Magazine, 3 July 1995
---------------------------------------------------------------------
Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199
--
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.