diff options
Diffstat (limited to 'lib/chef/resource/locale.rb')
-rw-r--r-- | lib/chef/resource/locale.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/chef/resource/locale.rb b/lib/chef/resource/locale.rb index f833a4e7d3..331786a02f 100644 --- a/lib/chef/resource/locale.rb +++ b/lib/chef/resource/locale.rb @@ -40,19 +40,19 @@ class Chef description: "A Hash of LC_* env variables in the form of ({ 'LC_ENV_VARIABLE' => 'VALUE' }).", default: lazy { {} }, coerce: proc { |h| - if h.respond_to?(:keys) - invalid_keys = h.keys - LC_VARIABLES - unless invalid_keys.empty? - error_msg = "Key of option lc_env must be equal to one of: \"#{LC_VARIABLES.join('", "')}\"! You passed \"#{invalid_keys.join(', ')}\"." - raise Chef::Exceptions::ValidationFailed, error_msg - end - end - unless h.values.all? { |x| x =~ LOCALE_REGEX } - error_msg = "Values of option lc_env should be non-empty string without any leading whitespaces." - raise Chef::Exceptions::ValidationFailed, error_msg - end - h - } + if h.respond_to?(:keys) + invalid_keys = h.keys - LC_VARIABLES + unless invalid_keys.empty? + error_msg = "Key of option lc_env must be equal to one of: \"#{LC_VARIABLES.join('", "')}\"! You passed \"#{invalid_keys.join(', ')}\"." + raise Chef::Exceptions::ValidationFailed, error_msg + end + end + unless h.values.all? { |x| x =~ LOCALE_REGEX } + error_msg = "Values of option lc_env should be non-empty string without any leading whitespaces." + raise Chef::Exceptions::ValidationFailed, error_msg + end + h + } # @deprecated Use {#lc_env} instead of this property. # {#lc_env} uses Hash with specific LC var as key. |