diff options
Diffstat (limited to 'lib/chef/mixin/why_run.rb')
-rw-r--r-- | lib/chef/mixin/why_run.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/chef/mixin/why_run.rb b/lib/chef/mixin/why_run.rb index efe327168e..357c4a655d 100644 --- a/lib/chef/mixin/why_run.rb +++ b/lib/chef/mixin/why_run.rb @@ -242,8 +242,12 @@ class Chef end end - def initialize(resource, run_context) - @resource, @run_context = resource, run_context + attr_accessor :action + + def initialize(resource, run_context, action) + @resource = resource + @run_context = run_context + @action = action @assertions = Hash.new { |h, k| h[k] = [] } @blocked_actions = [] end @@ -305,6 +309,8 @@ class Chef # "You don't have sufficient privileges to delete #{@new_resource.path}") # end def assert(*actions) + return unless actions.include?(action.to_sym) || actions.include?(:all_actions) + assertion = Assertion.new yield assertion actions.each { |action| @assertions[action] << assertion } |