diff options
author | John Keiser <john@johnkeiser.com> | 2016-01-29 16:11:28 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2016-02-01 12:23:18 -0800 |
commit | 862a85015b841b15541eeb372a642ab50ca210a9 (patch) | |
tree | 52e63646efa60a9769e6cb5efb802e32b7ab525c /lib/chef | |
parent | abc81c0eb35a73e15217371c37235d5f13f55df7 (diff) | |
download | chef-862a85015b841b15541eeb372a642ab50ca210a9.tar.gz |
Fix defaults on property_type
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/property.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 437ee10147..68d9b80103 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -129,7 +129,7 @@ class Chef end def to_s - "#{name}#{declared_in ? " of resource #{declared_in.resource_name}" : ""}" + "#{name || "<property type>"}#{declared_in ? " of resource #{declared_in.resource_name}" : ""}" end # @@ -463,7 +463,12 @@ class Chef def validate(resource, value) # If we have no default value, `nil` is never coerced or validated unless value.nil? && !has_default? - (resource || Chef::Mixin::ParamsValidate).validate({ name => value }, { name => validation_options }) + if resource + resource.validate({ name => value }, { name => validation_options }) + else + name = self.name || :property_type + (resource || Chef::Mixin::ParamsValidate).validate({ name => value }, { name => validation_options }) + end end end |