summaryrefslogtreecommitdiff
path: root/lib/chef/guard_interpreter
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2014-03-29 09:49:59 -0700
committerAdam Edwards <adamed@opscode.com>2014-03-29 09:49:59 -0700
commit43b3f4c0a48a5f6a5c242bb649f72239197b0097 (patch)
tree268112dd378aa7234f474e46efee1a97bcfaf12e /lib/chef/guard_interpreter
parent7d4f5e04ce9851dce6f97c72ffee8b2cca2b58bc (diff)
downloadchef-43b3f4c0a48a5f6a5c242bb649f72239197b0097.tar.gz
CR feedback: fix misleading method name for setting inheritance, validate class inheritance prior to instantiation
Diffstat (limited to 'lib/chef/guard_interpreter')
-rw-r--r--lib/chef/guard_interpreter/resource_guard_interpreter.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/guard_interpreter/resource_guard_interpreter.rb b/lib/chef/guard_interpreter/resource_guard_interpreter.rb
index fc1d4a1df8..229a8502c7 100644
--- a/lib/chef/guard_interpreter/resource_guard_interpreter.rb
+++ b/lib/chef/guard_interpreter/resource_guard_interpreter.rb
@@ -79,14 +79,14 @@ class Chef
raise ArgumentError, "Specified guard_interpreter resource #{parent_resource.guard_interpreter.to_s} unknown for this platform"
end
+ if ! resource_class.ancestors.include?(Chef::Resource::Script)
+ raise ArgumentError, "Specified guard interpreter class #{resource_class} must be a kind of Chef::Resource::Script resource"
+ end
+
empty_events = Chef::EventDispatch::Dispatcher.new
anonymous_run_context = Chef::RunContext.new(parent_resource.node, {}, empty_events)
interpreter_resource = resource_class.new('Guard resource', anonymous_run_context)
- if ! interpreter_resource.kind_of?(Chef::Resource::Script)
- raise ArgumentError, "Specified guard interpreter class #{resource_class} must be a kind of Chef::Resource::Script resource"
- end
-
interpreter_resource
end