Hi all, is there a way for qualifying variables inside a template? I''ve tried : Name = <%= "${::hostname}" %> but the var gets "${::hostname}" value. thinking in version 2.8, is it needed? http://docs.puppetlabs.com/guides/scope_and_puppet.html says nothing about this... TIA, Arnau -- 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.
Alessandro Franceschi
2011-Sep-20 18:53 UTC
[Puppet Users] Re: qualified variables in templates
Use something like <%= scope.lookupvar(''hostname'') %> On Sep 20, 11:06 am, Arnau Bria <arnaub...@pic.es> wrote:> Hi all, > > is there a way for qualifying variables inside a template? > I''ve tried : > > Name = <%= "${::hostname}" %> > > but the var gets "${::hostname}" value. > > thinking in version 2.8, is it needed?http://docs.puppetlabs.com/guides/scope_and_puppet.htmlsays nothing > about this... > > TIA, > Arnau-- 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.
Adrien Thebo
2011-Sep-20 18:54 UTC
Re: [Puppet Users] Re: qualified variables in templates
There''s also more documentation on using puppet specific methods in templates at http://docs.puppetlabs.com/guides/templating.html On Tue, Sep 20, 2011 at 11:53 AM, Alessandro Franceschi <al@lab42.it> wrote:> Use something like <%= scope.lookupvar(''hostname'') %> > > On Sep 20, 11:06 am, Arnau Bria <arnaub...@pic.es> wrote: > > Hi all, > > > > is there a way for qualifying variables inside a template? > > I''ve tried : > > > > Name = <%= "${::hostname}" %> > > > > but the var gets "${::hostname}" value. > > > > thinking in version 2.8, is it needed? > http://docs.puppetlabs.com/guides/scope_and_puppet.htmlsays nothing > > about this... > > > > TIA, > > Arnau > > -- > 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. > >-- Adrien Thebo Puppet Labs Operations adrien@puppetlabs.com -- 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.
Ok. so template and class share the scope and tehre''s no need to qualify its vars. Thanks for your replies and for the link. Cheers, Arnau -- 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.
what is the incantation that would work for iteration? scope.lookupvar(''::varname'').each Produces puppet error: undefined method `each'' for :undefined:Symbol On Tuesday, September 20, 2011 2:53:35 PM UTC-4, Alessandro Franceschi wrote:> > Use something like <%= scope.lookupvar(''hostname'') %> > >-- 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/-/popQN56eqs8J. 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, On 07/13/2012 09:46 PM, david boldt wrote:> what is the incantation that would work for iteration? > > scope.lookupvar(''::varname'').eachthis looks all right but> Produces puppet error: undefined method `each'' for :undefined:Symbolit seems that the lookup itself fails. Are you certain you''ve got the right name, and that the variable is defined in your context? It may also be more readable to do myvar = scope.lookupvar(''::varname'') myvar.each do ... HTH, Felix -- 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.