summaryrefslogtreecommitdiff
path: root/lib/chef/node/attribute.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-09-29 14:35:14 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-10-25 09:29:29 -0700
commit10904d6cf42a2a0ed69757aca3e80f512bb89379 (patch)
tree8ca5e167c77e3f2301a27c8926d7df72520fe7a3 /lib/chef/node/attribute.rb
parentc38fd335b667ccc8dcb1a0ae276be44f344c9fea (diff)
downloadchef-10904d6cf42a2a0ed69757aca3e80f512bb89379.tar.gz
standardize initializer args for VividMash+ImmutableMash
if anyone is using these directly this might be a breaking change, although it makes it considerably easier to use VividMash and IMO ImmutableMash is an implementation detail of the deep merge cache and Chef::Node object. we definitely have never documented these APIs, so I think the onus is on the consumer to update their code. VividMash.new() should now work. VividMash.new({ foo: :bar }) should also now work. IDK what object people would have been passing in as the root object before. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/node/attribute.rb')
-rw-r--r--lib/chef/node/attribute.rb40
1 files changed, 20 insertions, 20 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
#