Ask Your Question

How to correctly look up a fact in a template?

asked 2013-09-01 00:51:17 -0600

Which is more correct when looking up a fact (::is_pe) inside an ERB template?

<% if @is_pe == 'true' %>


<% if scope.lookupvar('::is_pe') == 'true' %>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-09-01 02:10:24 -0600

Ancillas gravatar image

If you're using ::ispe, then it's out of scope of your module, and you should use the latter approach (scope.lookupvar). If ispe is in scope (defined in your module), then use the former examle (@is_pe).

edit flag offensive delete link more



Referencing Variables seems to imply that ::is_pe will be available as @is_pe. I also remember a conversation on #puppet that said that a fact value (::is_pe) will always override a ...(more)

razorsedge gravatar imagerazorsedge ( 2013-09-01 15:11:40 -0600 )edit

"This can also be used to ensure that you are getting the top-scope value of a variable that may have been overridden in a local scope:". Local scope takes precedence ...(more)

Ancillas gravatar imageAncillas ( 2013-09-01 23:08:19 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-09-01 00:51:17 -0600

Seen: 3,204 times

Last updated: Sep 01 '13