Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created November 28, 2011 03:51
Show Gist options
  • Save adamhjk/1399016 to your computer and use it in GitHub Desktop.
Save adamhjk/1399016 to your computer and use it in GitHub Desktop.
Because you are so polite..
chef > var = node.default[:var]
=> #<Chef::Node::Attribute @normal={...}, @current_normal=nil, @default={...}, @current_default={}, @override={...}, @current_override=nil, @automatic={...}, @current_automatic=nil, @current_nesting_level=[:var], @auto_vivifiy_on_read=true, @set_unless_value_present=false, @set_type=:default, @has_been_read=false>
chef > var[:a] = 'a'
=> "a"
chef > var[:b][:c] = 'c'
=> "c"
chef > node.default[:var]
=> #<Chef::Node::Attribute @normal={...}, @current_normal=nil, @default={...}, @current_default={"a"=>"a", "b"=>{"c"=>"c"}}, override{....}, current_overridenil, automatic{....}, current_automaticnil, current_nesting_level[:var], auto_vivifiy_on_readtrue, set_unless_value_presentfalse, set_type:default, has_been_readfalse
chef > node.default[:var].to_hash
=> {"a"=>"a", "b"=>{"c"=>"c"}}
@raggi
Copy link

raggi commented Nov 28, 2011

My apologies, I did not describe the bug sufficiently accurately:

require 'rubygems'
require 'chef'
require 'pp'

node = Chef::Node.new
default = node.default
nginx = default[:nginx]
nginx[:core][:user] = "www-data"
nginx[:core][:worker_processes] = 10
pp node.to_hash
# {"name"=>nil,
# "nginx"=>{"core"=>{"core"=>{"worker_processes"=>10}, "user"=>"www-data"}},
# "chef_environment"=>"_default",
# "chef_type"=>"node"}

@fujin
Copy link

fujin commented Nov 28, 2011

What is this I don't even.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment