summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-23 10:21:39 -0700
committerGitHub <noreply@github.com>2018-10-23 10:21:39 -0700
commit81fc39e6055f39090a287e4f87eae0d31fa78ef0 (patch)
tree2575c0b7c6453fe8df5220687fc72e430b2dc060
parent3b9d5d9e8ba1821e12106c5646c84c6caf190702 (diff)
parent6c4c1d6a5c9eda3dc40b38a17d366a3bcac52582 (diff)
downloadchef-81fc39e6055f39090a287e4f87eae0d31fa78ef0.tar.gz
Merge pull request #7729 from chef/better_error2
Throw better error on invalid resources actions
-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 49e6914245..a71bec6958 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
+ # by inspecting the value instead of just printing it
+ raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{to_be.map { |v| v.inspect }.join(", ")}! You passed #{value.inspect}.")
end
end