summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/mixin/params_validate.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb
index f77adecd60..8a5f27c8fa 100644
--- a/lib/chef/mixin/params_validate.rb
+++ b/lib/chef/mixin/params_validate.rb
@@ -174,7 +174,9 @@ class Chef
to_be.each do |tb|
return true if value == tb
end
- raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{to_be.join(", ")}! You passed #{value.inspect}.")
+ # Ruby will print :something as something, which confuses users so make sure to print them as symbols
+ corrected_type_array = to_be.collect { |x| x.kind_of?(Symbol) ? ":#{x}" : x }
+ raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{corrected_type_array.join(", ")}! You passed #{value.inspect}.")
end
end