From 5caef70b1307d7d099c2621dc9ff7a4c0b3268d6 Mon Sep 17 00:00:00 2001 From: Adam Jacob Date: Thu, 2 Oct 2008 09:03:22 -0700 Subject: Supporting multiple actions --- lib/chef/resource.rb | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'lib/chef/resource.rb') diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index de10d44e88..866b77dc14 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -49,12 +49,22 @@ class Chef end def action(arg=nil) - arg = arg.to_sym if arg - set_or_return( - :action, - arg, - :equal_to => @allowed_actions - ) + if arg + action_list = arg.kind_of?(Array) ? arg : [ arg ] + action_list.each do |action| + validate( + { + :action => action, + }, + { + :object => { :equal_to => @allowed_actions }, + } + ) + end + @action = action_list + else + @action + end end def name(name=nil) -- cgit v1.2.1