On Friday, November 2, 2012 7:14:14 AM UTC-5, Erwin Bogaard wrote:
>
> As there is no response, maybe some extra info:
> For classes I use 'inherits' to apply multiple classes to one resource.
> For defines I can't find a similar technique. Is there one?
>
Perhaps there are no responses because your question is difficult to
understand. I don't think you are using Puppet jargon in the conventional
way.
In particular, you do not apply defines to resources, though you can apply
instances of defined types (which instances are resources) to nodes.
Likewise, you certainly do not apply classes to resources (though classes
can and normally do declare resources); rather, you apply classes to nodes.
Furthermore, there is no general issue with applying multiple distinct
instances of the same or different defined types to any given node. You
can, however, cause yourself trouble in that area with the way you write
the defines. To help you troubleshoot such an issue we would need to see
some details of the definitions.
Finally, *do not use class inheritance to combine classes*. Instead, use
the 'include' function, which is expressly for that purpose. Be aware that
'include' expresses a logical inclusion, not a textual one (i.e. it is
*not*analogous to the C preprocessor's #include directive), therefore it does
not cause multiple definition of the named class. Example:
class mymodule::class1 {
# resource declarations ...
}
class mymodule::class2 {
include 'mymodule::class1'
# other resource declarations ...
}
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/F9OocuG-55kJ.
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.