title: Chef custom attributes
body: <p>I'm working on a custom Chef Cookbook and have defined a custom attribute called <code>default["server"]["apikey"] = nil</code> thats been defined within the cookbook in a separate attributes file that looks like this: </p>
  
  <pre><code>#Default Attributes
  default["webhooks"]["get_response"] = ""
  default["webhooks"]["put_response"] = ""
  default["webhooks"]["post_response"] = ""
  
  default["server"]["username"] = "user"
  default["server"]["password"] = "123"
  
  default["server"]["apikey"] = nil 
  </code></pre>
  
  <p>Within my recipe I then do this:</p>
  
  <pre><code>webhooks_request "Request an API key from TPP " do
    uri "172.16.28.200/sdk/authorize/"
    post_data (
              { 'Username' =&gt; node["server"]["username"], 'Password' =&gt; node["server"]["password"]}
          )
    header_data (
                { 'content-type' =&gt; 'application/json'}
            )
    expected_response_codes [ 200, 201, 400 ]
    action :post
  end
  </code></pre>
  
  <p>I then follow this with <code>ruby_block</code> that updates the value of the ``default["server"]["apikey"]` attribute with the API key like this: </p>
  
  <pre><code>ruby_block "Extract the API Key" do
    block do
      jsonData = JSON.parse(node["webhooks"]["post_response"])
      jsonData.each do | k, v |
        if k == 'APIKey'
          node.overide["server"]["apikey"] = v
        end
      end
    end
    action :run
  end
  </code></pre>
  
  <p>I can then validate it using this: </p>
  
  <pre><code>ruby_block "Print API Key" do
    block do
      print "\nKey = : " + node["server"]["apikey"] + "\n"
    end
    action :run
  end
  </code></pre>
  
  <p>However, if I then try to use the <code>node["server"]["apikey"]</code> attribute in a following block like this:</p>
  
  <pre><code>webhooks_request "Get data from TPP" do
    uri "127.0.0.1/vedsdk/certificates/retrieve?apikey=#{node["server"]["apikey"]}"
    post_data (
                  { 'data' =&gt; "NsCVcQg4fd"}
          )
    header_data (
                { 'content-type' =&gt; 'application/json', 'auth' =&gt; node["server"] ["username"]}
                )
    expected_response_codes [ 200, 201, 400, 401 ]
    action :post
  end
  </code></pre>
  
  <p>The value of <code>node["server"]["apikey"]}</code> is always empty. Interestingly though the value of the <code>node["server"] ["username"]</code> attribute is available and works as expected. </p>
  
  <p>Obviously, I'm missing something here buy can't work out what :(</p>