Thanks for your reply. Let me clarify things a little more.
I use the following class to apply to a certain node:
class sugar::instances {
sugar::definitions_sugar {
# SugarCRM - ECM2
'node1':
mysql_dbname => 'dbname1',
mysql_pwd => 'password1';
sugar::definitions_sugar_wp {
'node2':
sugar_admin => 'text1',
sugar_pwd => 'password2',
mysql_dbname => 'dbname2',
mysql_pwd => 'password3';
As I wrote earlier: there are some nodes I like to apply just the
sugar-defines to, and there are nodes that I like to apply the
sugar-defines and the wordpress-defines to.
As you can see, some of the input (mysql_dbname/pwd) is the same for both
defines. So I would really like to reuse this. As I don't understand how to
apply multiple defines to one node, I use a workaround where I add the
information for sugar to both defines. As this isn't really a good idea and
creates extra work and a source for problems and inconsistency, I would
really like to have one define for sugar and one for wordpress. In that
situation I would like to apply only the sugar-define to node1 and both
defines to node2, when only declaring node2 once.
I hope this makes things clearer, but as you said, maybe I'm using the
wrong words (or jargon) for the right things.
On Friday, November 2, 2012 3:14:50 PM UTC+1, jcbollinger wrote:
>
>
>
> 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/-/PDFvcbKGP7IJ.
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.