diff options
author | Adam Jacob <adam@opscode.com> | 2010-04-15 17:37:31 -0700 |
---|---|---|
committer | Adam Jacob <adam@opscode.com> | 2010-04-15 17:37:31 -0700 |
commit | 92e5cf17f90bb885d016c667865e67eeec0a3458 (patch) | |
tree | 82a955681865698393f480ab61e3278b748c878a /chef | |
parent | db3eeb5f2b4977ce5d83d466f309567c95441d93 (diff) | |
download | chef-92e5cf17f90bb885d016c667865e67eeec0a3458.tar.gz |
Normalizing the attribute hash names, fixing spec
Diffstat (limited to 'chef')
-rw-r--r-- | chef/lib/chef/node.rb | 15 | ||||
-rw-r--r-- | chef/spec/unit/node_spec.rb | 6 |
2 files changed, 12 insertions, 9 deletions
diff --git a/chef/lib/chef/node.rb b/chef/lib/chef/node.rb index 8f63643fa6..fca5d4e595 100644 --- a/chef/lib/chef/node.rb +++ b/chef/lib/chef/node.rb @@ -356,10 +356,10 @@ class Chef result = { "name" => @name, 'json_class' => self.class.name, - "attributes" => @normal_attrs, + "normal" => @normal_attrs, "chef_type" => "node", - "defaults" => @default_attrs, - "overrides" => @override_attrs, + "default" => @default_attrs, + "override" => @override_attrs, "run_list" => @run_list.run_list, } result["_rev"] = @couchdb_rev if @couchdb_rev @@ -370,9 +370,12 @@ class Chef def self.json_create(o) node = new node.name(o["name"]) - node.normal_attrs = Mash.new(o["attributes"]) if o.has_key?("attributes") - node.default_attrs = Mash.new(o["defaults"]) if o.has_key?("defaults") - node.override_attrs = Mash.new(o["overrides"]) if o.has_key?("overrides") + if o.has_key?("attributes") + node.normal_attrs = o["attributes"] + end + node.normal_attrs = Mash.new(o["normal"]) if o.has_key?("normal") + node.default_attrs = Mash.new(o["default"]) if o.has_key?("default") + node.override_attrs = Mash.new(o["override"]) if o.has_key?("override") if o.has_key?("run_list") node.run_list.reset!(o["run_list"]) diff --git a/chef/spec/unit/node_spec.rb b/chef/spec/unit/node_spec.rb index d80b72752e..1789450bcb 100644 --- a/chef/spec/unit/node_spec.rb +++ b/chef/spec/unit/node_spec.rb @@ -344,9 +344,9 @@ describe Chef::Node do json = @node.to_json() json.should =~ /json_class/ json.should =~ /name/ - json.should =~ /attributes/ - json.should =~ /overrides/ - json.should =~ /defaults/ + json.should =~ /normal/ + json.should =~ /default/ + json.should =~ /override/ json.should =~ /run_list/ end |