summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2014-09-30 15:58:13 -0400
committerBryan McLellan <btm@loftninjas.org>2014-09-30 20:13:33 -0400
commitc0e6d45e8ca93bbaec11c24bc6c613c95dcebdbc (patch)
tree4bca8c78d0e790874eebfa50327b328413dc5101
parent11dae8e3cdf5ea6044c105beb94336c2778a1705 (diff)
downloadchef-c0e6d45e8ca93bbaec11c24bc6c613c95dcebdbc.tar.gz
Remove duplicate exception
We already check for command || block_given? in initialize, so command cannot be nil && not have a block when we get here.
-rw-r--r--lib/chef/resource/conditional.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/resource/conditional.rb b/lib/chef/resource/conditional.rb
index 140078d39a..324c5a4676 100644
--- a/lib/chef/resource/conditional.rb
+++ b/lib/chef/resource/conditional.rb
@@ -59,6 +59,7 @@ class Chef
@guard_interpreter = new_guard_interpreter(@parent_resource, @command, @command_opts, &@block)
@block = nil
when nil
+ # we should have a block if we get here
if @parent_resource.guard_interpreter != :default
msg = "#{@parent_resource.name} was given a guard_interpreter of #{@parent_resource.guard_interpreter}, "
msg << "but not given a command as a string. guard_interpreter does not support blocks (because they just contain ruby)."
@@ -68,7 +69,8 @@ class Chef
@guard_interpreter = nil
@command, @command_opts = nil, nil
else
- raise ArgumentError, "Invalid only_if/not_if command: #{command.inspect} (#{command.class})"
+ # command was passed, but it wasn't a String
+ raise ArgumentError, "Invalid only_if/not_if command, expected a string: #{command.inspect} (#{command.class})"
end
end