Martin Alfke writes:
How can I access the variable from the first define? I can
change the second define to have another parameter so it knows
about the template variable. Is there any other solution
available?
It's not exactly the same, but this works now, using EPP instead
of ERB:
scope_epp/manifests/define1.pp
~~~
define scope_epp::define1 ($var = 'test') {
scope_epp::define2 { $name:
epp => 'scope_epp/test.epp',
}
}
~~~ scope_epp/manifests/define2.pp
~~~
define scope_epp::define2 ($epp) {
notify { $name:
message => epp($epp, {'name' => $name}),
}
}
~~~ scope_epp/templates/test.epp
~~~ <%= Scope_epp::Define1[$name]['var'] %> ~~~
Then running:
% /opt/puppetlabs/bin/puppet apply -e 'scope_epp::define1 {
"thing": }' --modulepath=. Notice: Compiled catalog for localhost
in environment production in 0.64 seconds Notice: test Notice:
/Stage[main]/Main/Scope_epp::Define1[thing]/Scope_epp::Define2[thing]/Notify[thing]/message:
defined 'message' as 'test' You can't use that to access
variables from the defined type, but you can access parameters.
Now whether you should do that or not...
--
You received this message because you are subscribed to the Google Groups "Puppet
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/87mvxxspjc.fsf%40rafiki.corp.puppetlabs.net.
For more options, visit https://groups.google.com/d/optout.