title: access updated node attributes in cookbook recipe
body: <p>I am new to chef environment. And working on a simple cookbook.</p>
  
  <p>To simplify, I have following attributes in: </p>
  
  <p>attributes/default.rb:</p>
  
  <pre><code>default[:user1] = ""
  default[:user2] = ""
  default[:filename] = ""
  </code></pre>
  
  <p>recipes/default.rb:
  At run time, I get a filename from another cookbook and I have to extract users from that file.</p>
  
  <pre><code>file = "#{node[:filename]}"
  
  ruby_block 'extract userdata' do
    block do
      json = File.read(file)
      obj = JSON.parse(json)
  
      userdata = obj['users']
  
      if userdata.empty?
        raise "Errors: userdata not available"
      else
        node.override[:user1] = userdata['user1']
        node.override[:user2] = userdata['user2']
      end
    end
    puts "user1: #{node[:user1]}"
    puts "user2: #{node[:user2]}"
    action :run
  end
  </code></pre>
  
  <p>logs (puts) from above block at runtime do fetch me usernames correctly.</p>
  
  <p>Now, I am trying to use above two updated attributes as below in further down the cookbook recipe.</p>
  
  <pre><code>user1 = #{node[:user1]}
  user2 = #{node[:user2]}
  </code></pre>
  
  <p>But these two values are coming out to be empty as if they are not set/overriden.</p>
  
  <p>Please suggest how can I get updated data.</p>