summaryrefslogtreecommitdiff
path: root/lib/chef/resource/file
diff options
context:
space:
mode:
authorSteven Danna <steve@opscode.com>2015-01-19 09:44:46 +0000
committerBryan McLellan <btm@opscode.com>2015-02-17 08:46:37 -0500
commit664172ea426c2c0dfd965b69a0e1ae75af34a89f (patch)
tree1dabbe4a594adb0a941dfbb28787bee98e46cd34 /lib/chef/resource/file
parent671b5d63236841a74ba0c15879027c35e488a849 (diff)
downloadchef-664172ea426c2c0dfd965b69a0e1ae75af34a89f.tar.gz
Add Chef::GuardInterpreter.for_resource method to reduce duplication
Diffstat (limited to 'lib/chef/resource/file')
-rw-r--r--lib/chef/resource/file/verification.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index 4071aaaeaa..f1ca0f1883 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -17,6 +17,7 @@
#
require 'chef/exceptions'
+require 'chef/guard_interpreter'
require 'chef/mixin/descendants_tracker'
class Chef
@@ -106,11 +107,7 @@ class Chef
# the same set of options that the not_if/only_if blocks do
def verify_command(path, opts)
command = @command % {:file => path}
- interpreter = if @parent_resource.guard_interpreter == :default
- Chef::GuardInterpreter::DefaultGuardInterpreter.new(command, @command_opts)
- else
- Chef::GuardInterpreter::ResourceGuardInterpreter.new(@parent_resource, command, @command_opts)
- end
+ interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts)
interpreter.evaluate
end