Hi, Michael! thanks for your reply! actually it is the opposite.. :) i.e, I want to use the same variable, but in different definitions...
Using classes, I can accomplish that using class inheritance, but with definitions.. I have no clue... Just to clarify the reason of that... 1) I have a couple of common variables 2) I have a define A 2) I have a define B I need to have multiple instances of objects defined in define A in one host and multiple instances of objects defined in define B on another host, but both define (A and B) share a couple of variables... Using classes this is pretty straight forward, but since classes are singleton, I need to use Definitions and I don't know how to do that without putting the "shared variables" in each definition. I hope, I have managed to clarify the issue. Cheers, Gus On Wed, Mar 24, 2010 at 6:22 PM, Michael DeHaan <[email protected]>wrote: > > > On Wed, Mar 24, 2010 at 5:11 PM, Michael DeHaan <[email protected] > > wrote: > >> >> On Wed, Mar 24, 2010 at 3:10 PM, Gustavo Soares >> <[email protected]>wrote: >> >>> Hi everybody! >>> >>> I would like to share a group of variables between definitions and I >>> don't know what it is the best approach to do this... >>> >>> First, let me explain the situation... >>> >>> I were using a class and defining those variables inside of it.. then I >>> used inheritance to this class to >>> get the variables instantiated. >>> >>> For instance: >>> >>> class common_variables { >>> $a_var = "hello world" >>> } >>> >>> class class_a inherits common_variables { >>> notice($a_var) >>> } >>> >>> class class_b inherits common_variables { >>> notice($a_var) >>> } >>> >> >> >> If I understand this correctly, you'd like to use different variables with >> the same definitions? >> >> This sends "5" as a notice value: >> >> class base { >> $x=3 >> define yell($what) { >> notice($what) >> } >> } >> >> class outera inherits base { >> $x=4 >> base::yell { "some title" : what => $x } >> } >> >> class outerb inherits base { >> $x=5 >> base::yell { "some title" : what => $x } >> } >> >> >> > Sorry for the confusion -- > > I'm missing a "include base" at the very bottom of my example. > > If that's not what you meant about variables in defines, please clarify. > > > >> > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<puppet-users%[email protected]> > . > 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 [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.
