Lazy on template variables right syntax


#1

Hi!!

What is the right syntax on themplates to use lazy with variables
attribute? I have seen two ways:

variables lazy {{ :key =>node[‘foo’], … }}

and

variables ( :key => lazy {node[‘bar’],… )

I havent tested second one yet, but with the first one wich works,
foodcritic says:

FC009: Resource attribute not recognised: ./recipes/default.rb:39

So what is the right way? On the docs, lazy is never mentioned within
templates resource but generic way.

Si necesitas una máquina para hacer algo y no la compras al final te darás
cuenta de que has pagado lo mismo y no tienes la máquina.–Henry Ford

Alberto


#2

Did you try:

variables(lazy {{ :key => node[‘foo’], …}})

??

Tom Duffield — Automation Consulting Engineer

651.769.7497 – tom@getchef.com – *my:
*Linkedinhttp://www.linkedin.com/in/thomasduffield
Twitter http://www.twitter.com/tomduffield
CHEF

GETCHEF.COM http://www.getchef.com/

TM

getchef.com http://www.getchef.com/ Bloghttp://www.opscode.com/blog/
Facebook https://www.facebook.com/getchefdotcom
Twitterhttps://twitter.com/getchefdotcom
Youtube https://www.youtube.com/getchef

Meet me at #ChefConf 2014 http://chefconf.com/

On Thu, Mar 6, 2014 at 7:32 AM, aL. ocholetrasaleatorias@gmail.com wrote:

Hi!!

What is the right syntax on themplates to use lazy with variables
attribute? I have seen two ways:

variables lazy {{ :key =>node[‘foo’], … }}

and

variables ( :key => lazy {node[‘bar’],… )

I havent tested second one yet, but with the first one wich works,
foodcritic says:

FC009: Resource attribute not recognised: ./recipes/default.rb:39

So what is the right way? On the docs, lazy is never mentioned within
templates resource but generic way.

Si necesitas una máquina para hacer algo y no la compras al final te darás
cuenta de que has pagado lo mismo y no tienes la máquina.–Henry Ford

Alberto