summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-10-13 09:30:46 -0700
committerGitHub <noreply@github.com>2016-10-13 09:30:46 -0700
commit7a3a945bb66069ff3d22a36ed914d90ac45c72cf (patch)
tree865a5dee3b36a7a3a87584cd3e3f83185c9ca8ac
parent91f37f3571711fae47ffc327f220c13bba9cf7bd (diff)
parent11d64c2438d6e387986adce3d4740f2bc7efaab9 (diff)
downloadchef-7a3a945bb66069ff3d22a36ed914d90ac45c72cf.tar.gz
Merge pull request #5446 from chef/lcg/tweak-delayed-action-api
Core: make delayed_action argument mandatory, remove misleading ivar introduced in PR that added delayed_action
-rw-r--r--lib/chef/resource.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 8048330ce1..074ab772a1 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -186,22 +186,16 @@ class Chef
# This should most likely be paired with action :nothing
#
# @param arg [Array[Symbol], Symbol] A list of actions (e.g. `:create`)
- # @return [Array[Symbol]] the list of actions.
#
- def delayed_action(arg = nil)
- if arg
- arg = Array(arg).map(&:to_sym)
- arg.each do |action|
- validate(
- { action: action },
- { action: { kind_of: Symbol, equal_to: allowed_actions } }
- )
- # the resource effectively sends a delayed notification to itself
- run_context.add_delayed_action(Notification.new(self, action, self))
- end
- @delayed_action = arg
- else
- @delayed_action
+ def delayed_action(arg)
+ arg = Array(arg).map(&:to_sym)
+ arg.map do |action|
+ validate(
+ { action: action },
+ { action: { kind_of: Symbol, equal_to: allowed_actions } }
+ )
+ # the resource effectively sends a delayed notification to itself
+ run_context.add_delayed_action(Notification.new(self, action, self))
end
end