diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/node/attribute.rb | 40 | ||||
-rw-r--r-- | lib/chef/node/attribute_collections.rb | 15 | ||||
-rw-r--r-- | lib/chef/node/immutable_collections.rb | 4 | ||||
-rw-r--r-- | lib/chef/node/mixin/state_tracking.rb | 2 |
4 files changed, 31 insertions, 30 deletions
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 747f7f623c..67b114a270 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -188,19 +188,19 @@ class Chef attr_reader :automatic def initialize(normal, default, override, automatic) - @default = VividMash.new(self, default) - @env_default = VividMash.new(self, {}) - @role_default = VividMash.new(self, {}) - @force_default = VividMash.new(self, {}) + @default = VividMash.new(default, self) + @env_default = VividMash.new({}, self) + @role_default = VividMash.new({}, self) + @force_default = VividMash.new({}, self) - @normal = VividMash.new(self, normal) + @normal = VividMash.new(normal, self) - @override = VividMash.new(self, override) - @role_override = VividMash.new(self, {}) - @env_override = VividMash.new(self, {}) - @force_override = VividMash.new(self, {}) + @override = VividMash.new(override, self) + @role_override = VividMash.new({}, self) + @env_override = VividMash.new({}, self) + @force_override = VividMash.new({}, self) - @automatic = VividMash.new(self, automatic) + @automatic = VividMash.new(automatic, self) super() end @@ -232,59 +232,59 @@ class Chef # Set the cookbook level default attribute component to +new_data+. def default=(new_data) reset - @default = VividMash.new(self, new_data) + @default = VividMash.new(new_data, self) end # Set the role level default attribute component to +new_data+ def role_default=(new_data) reset - @role_default = VividMash.new(self, new_data) + @role_default = VividMash.new(new_data, self) end # Set the environment level default attribute component to +new_data+ def env_default=(new_data) reset - @env_default = VividMash.new(self, new_data) + @env_default = VividMash.new(new_data, self) end # Set the force_default (+default!+) level attributes to +new_data+ def force_default=(new_data) reset - @force_default = VividMash.new(self, new_data) + @force_default = VividMash.new(new_data, self) end # Set the normal level attribute component to +new_data+ def normal=(new_data) reset - @normal = VividMash.new(self, new_data) + @normal = VividMash.new(new_data, self) end # Set the cookbook level override attribute component to +new_data+ def override=(new_data) reset - @override = VividMash.new(self, new_data) + @override = VividMash.new(new_data, self) end # Set the role level override attribute component to +new_data+ def role_override=(new_data) reset - @role_override = VividMash.new(self, new_data) + @role_override = VividMash.new(new_data, self) end # Set the environment level override attribute component to +new_data+ def env_override=(new_data) reset - @env_override = VividMash.new(self, new_data) + @env_override = VividMash.new(new_data, self) end def force_override=(new_data) reset - @force_override = VividMash.new(self, new_data) + @force_override = VividMash.new(new_data, self) end def automatic=(new_data) reset - @automatic = VividMash.new(self, new_data) + @automatic = VividMash.new(new_data, self) end # diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb index c7482799cc..be87c028cb 100644 --- a/lib/chef/node/attribute_collections.rb +++ b/lib/chef/node/attribute_collections.rb @@ -69,7 +69,7 @@ class Chef end end - def initialize(root = self, data = []) + def initialize(data = [], root = self) @__root ||= root super(data) map! { |e| convert_value(e) } @@ -95,9 +95,9 @@ class Chef when AttrArray value when Hash - VividMash.new(__root, value) + VividMash.new(value, __root) when Array - AttrArray.new(__root, value) + AttrArray.new(value, __root) else value end @@ -150,7 +150,8 @@ class Chef end end - def initialize(root = self, data = {}) + def initialize(data = {}, root = self) + puts caller unless root.class == Chef::Node::Attribute @__root ||= root super(data) end @@ -159,7 +160,7 @@ class Chef __root.top_level_breadcrumb ||= key value = super if !key?(key) - value = self.class.new(__root) + value = self.class.new({}, __root) self[key] = value else value @@ -208,9 +209,9 @@ class Chef when AttrArray value when Hash - VividMash.new(__root, value) + VividMash.new(value, __root) when Array - AttrArray.new(__root, value) + AttrArray.new(value, __root) else value end diff --git a/lib/chef/node/immutable_collections.rb b/lib/chef/node/immutable_collections.rb index 9d34048c79..50ac8daf93 100644 --- a/lib/chef/node/immutable_collections.rb +++ b/lib/chef/node/immutable_collections.rb @@ -52,7 +52,7 @@ class Chef alias :internal_push :<< private :internal_push - def initialize(array_data, root = self) + def initialize(array_data = [], root = self) @__root = root array_data.each do |value| internal_push(immutablize(value)) @@ -114,7 +114,7 @@ class Chef alias :internal_set :[]= private :internal_set - def initialize(mash_data, root = self) + def initialize(mash_data = {}, root = self) @__root = root mash_data.each do |key, value| internal_set(key, immutablize(value)) diff --git a/lib/chef/node/mixin/state_tracking.rb b/lib/chef/node/mixin/state_tracking.rb index fed040ed92..7472d2a67d 100644 --- a/lib/chef/node/mixin/state_tracking.rb +++ b/lib/chef/node/mixin/state_tracking.rb @@ -23,7 +23,7 @@ class Chef attr_reader :__root def initialize(*args) - super + super(*args) @__path ||= [] @__root ||= self end |