OK. Actually it worked when I added:

$hibernate_connection_dialect=$templates_eval::providevars::hibernate_connection_dialect

This solves the base problem but at the same time creates another one: I do not 
have to include variables from only one class but depending one some 
environment settings from different classes. Maybe I've just picked a 
completely wrong approach, so I'd just like to show what I mean with some 
(none-Puppet) pseudo code:

If (environment == "envX")
Then
        $hibernate_connection_dialect=$envX::hibernate_connection_dialect
Else if (environment == "envY")
Then
        $hibernate_connection_dialect=$envY::hibernate_connection_dialect
End

But actually I don't want is to have code like this - the redefinition of every 
variable depending on the environment. I was thinking about some kind of 
associative array which would allow to iterate over values 'envX', 'envY', etc. 
But again this would lead to a redefinition and I think Puppet does not have 
the feature of assoc. array. (Right?)

Inheritance, as mentioned by Mike, is also not possible since I would then need 
some kind of 'dynamic' inheritance like this (pseudo code again):

If (environment == "envX")
Then
        class env inhertit $envX::class {

        }
End

Seems this is not possible in Puppet, too. So maybe there's a completely 
different approach in Puppet for accomplishing this problem (?)

Thanks Bernd


>> It should work if you just explicitly assign the variable in the scope where 
>> you execute the template function. 
> 
>    58 class templates_eval::testvars {
>    59
>    60     include templates_eval::providevars
>    61
>       
>>        61.5 
>>hibernate_connection_dialect=templates_eval::providevars::hibernate_connection_dialect
> 
>    62     file {
>    63         "/tmp/tmplteval.properties":
>    64             ensure => "present",
>    65             mode => 644,
>    66             content => template("templates_eval/global.properties.erb"),
>    67     }
>    68 }


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