new variable scoping in templates

98 views
Skip to first unread message

lurdan

unread,
Jul 14, 2011, 10:45:36 PM7/14/11
to Puppet Users
hi,

What's the best way to refer variables which pass as defined resource
parameter
from template erbs?

I've been made many modules which has resource definitions containing
file templating.
After I upgrade my puppet version to 2.7.0rc (debian experimental),
I'm getting many
warnings "Dynamic lookup is deprecated. Support will be removed in
Puppet 2.8.".

I can surpress this warnings with rewriting from:
<%= some_arg %>
to:
<%= scope.to_hash.fetch('some_arg') %>, but this should be bad way
because
it seems ugly and meaningless.
(It's not an explicit scope declaration, simply variable-syntax
longed...)

regards,
--
KURASHIKI Satoru

Justin Lambert

unread,
Jul 15, 2011, 10:57:58 AM7/15/11
to puppet...@googlegroups.com
I've been using:

scope.lookupvar('puppet::params::certdnsnames')


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


Greg Etling

unread,
Jul 15, 2011, 11:26:23 AM7/15/11
to puppet...@googlegroups.com
Justin,

What would the syntax be along those lines when looking up custom facts?

Nan Liu

unread,
Jul 15, 2011, 1:42:23 PM7/15/11
to puppet...@googlegroups.com
Facts are top scope, so simply ::factname such as
scope.lookupvar('::operatingsystem')

On Fri, Jul 15, 2011 at 8:26 AM, Greg Etling <get...@stern.nyu.edu> wrote:
> Justin,
> What would the syntax be along those lines when looking up custom facts?
>

> --
> 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/-/BB3TAoW6PVEJ.


> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

--
==========================================
Join us in PDX for PuppetConf: http://bit.ly/puppetconfsig

Greg Etling

unread,
Jul 15, 2011, 1:47:43 PM7/15/11
to puppet...@googlegroups.com
Nan, that's exactly what I thought. I posted another thread with more details on the issue I'm seeing though, so I won't go into my issues here.
Reply all
Reply to author
Forward
0 new messages