Hi guys, I''m working on puppet for windows, and now I have to work on a template that use the value from a variable set it on a class, the problem that i got is always I got undef value on the result file. I checked this URL without no results http://stackoverflow.com/questions/10589404/puppet-cant-find-variable-for-template These are my classes variables: class direct::config () { require direct::setup $nameSite = ''some.site.com'' .. } and this where I use it on my template locate on direct/templates/conf/css.erb: . DomainIP <%= @ipaddress %>,127.0.0.1 DefServerName <%= scope.lookupvar("direct::config::nameSite") %> . . And the file results css.cfg: . DomainIP 10.10.10.23,127.0.0.1 DefServerName undefined . . I expected DefServerName some.site.com Could you help me with this issue? What Am I doing wrong? Thank you in advance... Best Regards. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/-2FK6mx9ESQJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jakov Sosic
2012-Dec-13 17:28 UTC
Re: [Puppet Users] help with scoping variable into a template
On 10/29/2012 09:11 PM, mparrad wrote:> Hi guys, > > I''m working on puppet for windows, and now I have to work on a template > that use the value from a variable set it on a class, the problem that i > got is always I got undef value on the result file. > I checked this URL without no results > http://stackoverflow.com/questions/10589404/puppet-cant-find-variable-for-template > > These are my classes variables: > > class direct::config () { > > require direct::setup > > $nameSite = ''some.site.com'' > .. > } > > and this where I use it on my template locate on > direct/templates/conf/css.erb: > . > DomainIP <%= @ipaddress %>,127.0.0.1 > DefServerName <%= scope.lookupvar("direct::config::nameSite") %> > . > . > > > And the file results css.cfg: > . > DomainIP 10.10.10.23,127.0.0.1 > DefServerName undefined > . > . > > I expected DefServerName some.site.com > > Could you help me with this issue? What Am I doing wrong?Do you have direct::config included in your host manifest anywhere? Also could you paste part of the code (including the wrapper class) that defines file which uses template css.erb? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.