summaryrefslogtreecommitdiff
path: root/lib/chef/property.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2017-04-03 22:05:00 -0500
committerNoah Kantrowitz <noah@coderanger.net>2017-04-03 22:05:00 -0500
commitb95a1bb1d167d31f56892baf7e424c146ebba0b4 (patch)
tree234ee809abbb538c5d9f9c920a126a25ded03d00 /lib/chef/property.rb
parent41fa5caa4a75abf71aaf435c77423adf2b3d0306 (diff)
downloadchef-b95a1bb1d167d31f56892baf7e424c146ebba0b4.tar.gz
Freeze the default value for properties unless it is a lazy.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/property.rb')
-rw-r--r--lib/chef/property.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb
index c6f72e15a7..ecc23b701c 100644
--- a/lib/chef/property.rb
+++ b/lib/chef/property.rb
@@ -110,6 +110,9 @@ class Chef
raise ArgumentError, "Cannot specify both default and name_property/name_attribute together on property #{self}"
end
+ # Freeze the default if it isn't a lazy value.
+ default.freeze unless default.is_a?(DelayedEvaluator)
+
# Validate the default early, so the user gets a good error message, and
# cache it so we don't do it again if so
begin