On Mon, Apr 26, 2010 at 4:24 AM, Bernd Adamowicz <
bernd.adamow...@esailors.de> wrote:

> Hi all,
>
> given these two classes inside the file
> '/etc/puppet/modules/templates_eval/manifests/init.pp':
>
>     53 class templates_eval::providevars {
>     54
>     55
> $hibernate_connection_dialect="org.hibernate.dialect.Oracle10gDialect"
>     56 }
>     57
>

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 }
>
> The file '/etc/puppet/manifests/site.pp' includes class
> 'templates_eval::testvars':
>
>     13 node "myhostname.net" {
>        ...
>     17     include templates_eval::testvars
>     18 }
>

> This is the content of template
> '/etc/puppet/modules/templates_eval/templates/global.properties.erb':
>
>     12
>     13 domain.suffix=<%= fqdn %>
>     14
>     15 hibernate.connection.dialect=<%= hibernate_connection_dialect  %>
>
> However, when running Puppet on a Puppet node, obviously the variable
> '$hibernate_connection_dialect' cannot be resolved:
>
> [r...@myhostname puppet]# puppetd -v -d --test
> ...
> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Failed to parse template templates_eval/global.properties.erb: Could not
> find value for 'hibernate_connection_dialect' at
> /etc/puppet/modules/templates_eval/manifests/init.pp:64 on node
> myhostname.net
> warning: Not using cache on failed catalog
> err: Could not retrieve catalog; skipping run
> [r...@myhostname puppet]#
>
> Obviously the 'include templates_eval::providevars' inside class
> 'templates_eval::testvars' has no impact. I tried several other approaches
> (importing manifests, etc.), too. But none of them worked. So the basic
> question is: How can I have a set of variables defined in scope X (where X
> might be a manifest, a class, or a define) and include it into scope Y
> (where Y will most likely be a class or maybe a node).
>
> Thanks in advance for any help!
> Bernd
>
> --
> 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<puppet-users%2bunsubscr...@googlegroups.com>
> .
> 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 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