Hi group. I have such construction: node "hostname" { $passwd = "222" include myclass } class myclass { $passwd = "111" file { "/var/tmp/myclass.conf": owner => root, group => wheel, mode => 640, backup => false, content => template("myclass.conf"), require => file["/var/tmp"], } } and myclass.conf content is "my_passwd="<%= passwd %>"" and when i exec puppetd, then "cat /var/tmp/myclass.conf" output "111" but as i`ve seen in puppet book my construction must have in output "222" pls tell me the true :) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
nmay wrote:> Hi group. > I have such construction: > node "hostname" { > $passwd = "222" > include myclass > } > > class myclass { > $passwd = "111" >I think you should have class myclass ($passwd = "111") { file {"....> file { "/var/tmp/myclass.conf": > owner => root, > group => wheel, > mode => 640, > backup => false, > content => template("myclass.conf"), > require => file["/var/tmp"], > } > } > > and myclass.conf content is > "my_passwd="<%= passwd %>"" >-- Trevor Hemsley Infrastructure Engineer ................................................. * C A L Y P S O * Brighton, UK OFFICE +44 (0) 1273 666 350 FAX +44 (0) 1273 666 351 ................................................. www.calypso.com This electronic-mail might contain confidential information intended only for the use by the entity named. If the reader of this message is not the intended recipient, the reader is hereby notified that any dissemination, distribution or copying is strictly prohibited. * P * /*/ Please consider the environment before printing this e-mail /*/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi> I think you should have > > class myclass ($passwd = "111") { > file {"....this syntax is completely new to me, where is it documented? thanks and cheers pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, Aug 18, 2009 at 9:05 AM, Peter Meier<peter.meier@immerda.ch> wrote:> > Hi > >> I think you should have >> >> class myclass ($passwd = "111") { >> file {".... > > this syntax is completely new to me, where is it documented? > > thanks and cheers pete >It is document under variable scope in the puppet language guide. The short version or rule of thumb I use is "closet scope gets used". Not sure if that is the best way, but it seems to work. Evan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Evan Hisey wrote:>>> I think you should have >>> >>> class myclass ($passwd = "111") { >>> file {".... >> this syntax is completely new to me, where is it documented? >> >> thanks and cheers pete >> > It is document under variable scope in the puppet language guide. The > short version or rule of thumb I use is "closet scope gets used". Not > sure if that is the best way, but it seems to work.http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#variable-scope does not mention that syntax as far as I can see. It tells us how scoping works, but no mention about putting variable assignments inside parenthesis between the class name and the opening brace of the class body. And more tellingly, actually trying it with Puppet errors out with the message "Syntax error at ''(''; expected '')''". That section of the language tutorial *does* show how the original poster should solve his problem. But it is not with the syntax that Trevor suggested. /Bellman --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Thu, Aug 27, 2009 at 3:02 AM, Thomas Bellman<bellman@nsc.liu.se> wrote:> > Evan Hisey wrote: > >>>> I think you should have >>>> >>>> class myclass ($passwd = "111") { >>>> file {".... >>> this syntax is completely new to me, where is it documented? >>>> http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#variable-scope > does not mention that syntax as far as I can see. It tells us how > scoping works, but no mention about putting variable assignments > inside parenthesis between the class name and the opening brace of > the class body. And more tellingly, actually trying it with Puppet > errors out with the message "Syntax error at ''(''; expected '')''". > > That section of the language tutorial *does* show how the original > poster should solve his problem. But it is not with the syntax that > Trevor suggested.Your right missed that part. Evan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---