diff options
author | Adam Edwards <adamed@opscode.com> | 2014-03-28 11:14:56 -0700 |
---|---|---|
committer | Adam Edwards <adamed@opscode.com> | 2014-03-29 00:21:11 -0700 |
commit | e0b02d69aaf9f408cfd9dbe9ea47561f694815bf (patch) | |
tree | 23d29bb34f82f8da8e622668c5e89d27ada6ba81 /lib/chef/resource/conditional.rb | |
parent | b57795c468a366ff8d755e22f1364c10a5d27af9 (diff) | |
download | chef-e0b02d69aaf9f408cfd9dbe9ea47561f694815bf.tar.gz |
CR feedback: refactor guard interpreter logic out of Resource into Conditional
Diffstat (limited to 'lib/chef/resource/conditional.rb')
-rw-r--r-- | lib/chef/resource/conditional.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/chef/resource/conditional.rb b/lib/chef/resource/conditional.rb index 60f65e14e2..94c4fe03f4 100644 --- a/lib/chef/resource/conditional.rb +++ b/lib/chef/resource/conditional.rb @@ -17,6 +17,7 @@ # require 'chef/mixin/shell_out' +require 'chef/resource/conditional/guard_interpreter' class Chef class Resource @@ -29,12 +30,14 @@ class Chef private :new end - def self.not_if(command=nil, command_opts={}, &block) - new(:not_if, command, command_opts, &block) + def self.not_if(parent_resource, command=nil, command_opts={}, &block) + translated_command, translated_block = Chef::GuardInterpreter.translate_command_block(parent_resource, command, command_opts, &block) + new(:not_if, translated_command, command_opts, &translated_block) end - def self.only_if(command=nil, command_opts={}, &block) - new(:only_if, command, command_opts, &block) + def self.only_if(parent_resource, command=nil, command_opts={}, &block) + translated_command, translated_block = Chef::GuardInterpreter.translate_command_block(parent_resource, command, command_opts, &block) + new(:only_if, translated_command, command_opts, &translated_block) end attr_reader :positivity |