On Wed, Mar 24, 2010 at 3:10 PM, Gustavo Soares <gustavosoa...@gmail.com>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 }
}


Let me know if I misunderstood.

--Michael

-- 
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