title: chef node attribute from ruby block - lazy eval
body: <p>How do I set the node level attributes in ruby block. I have a use case where I use the attribute across all the resources.
  I was reading about converge vs compile time, I get it. But I need some suggestions on how to use the lazy evaluation here.</p>
  
  <p>Here is my code, reads a json file and use the value as a node attribute</p>
  
  <pre><code>ruby_block 'package' do
    block do
      file = open("/tmp/pkg.json")
      json = file.read
      parsed = JSON.parse(json)
      node.override['artifact']['version'] = parsed["artifact"]["version"]
    end
    only_if { File.exist?("/tmp/pkg.json") }
    action :run
  end
  </code></pre>
  
  <p>and recipe follows as</p>
  
  <p><code>deploy_art = "#{id}-#{node['artifact']['version']}.war".</code>  <strong>&lt;&lt;--- How do I use lazy eval here?</strong> </p>
  
  <p>Tried this, no luck</p>
  
  <p><code>deploy_art = "#{id}-lazy{ #{node['artifact']['version']}}.war"</code> <strong>with lazy eval</strong></p>
  
  <p>I would like to construct deploy_art variable with ruby_block attribute for further logic(s) to work across the recipe.
  Apparently, I would like to use lazy eval as a clean way.</p>