summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2015-01-05 14:54:44 -0800
committertyler-ball <tyleraball@gmail.com>2015-01-05 14:54:44 -0800
commit6f955972033c5117ef83010977a2aa1ff023e691 (patch)
treee5e51f71c09e8fff368c9fbcd22cfe2a799bbf92 /lib/chef/resource
parent005f75e158ce702bb28fd6199e9654b3d1115d3b (diff)
downloadchef-6f955972033c5117ef83010977a2aa1ff023e691.tar.gz
Fixing #2694 - resource guards are executed in why_run modetball/guard_interpreter
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/execute.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb
index 6853b62887..9f8b629fb8 100644
--- a/lib/chef/resource/execute.rb
+++ b/lib/chef/resource/execute.rb
@@ -26,6 +26,12 @@ class Chef
identity_attr :command
+ # The ResourceGuardInterpreter wraps a resource's guards in another resource. That inner resource
+ # needs to behave differently during (for example) why_run mode, so we flag it here. For why_run mode
+ # we still want to execute the guard resource even if we are not executing the wrapping resource.
+ # Only execute resources (and subclasses) can be guard interpreters.
+ attr_accessor :is_guard_interpreter
+
def initialize(name, run_context=nil)
super
@resource_name = :execute
@@ -43,6 +49,7 @@ class Chef
@allowed_actions.push(:run)
@umask = nil
@default_guard_interpreter = :execute
+ @is_guard_interpreter = false
end
def umask(arg=nil)