summaryrefslogtreecommitdiff
path: root/lib/chef/resource.rb
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2008-10-02 09:03:22 -0700
committerAdam Jacob <adam@hjksolutions.com>2008-10-02 09:03:22 -0700
commit5caef70b1307d7d099c2621dc9ff7a4c0b3268d6 (patch)
tree2a6ca8e9cf5be68798f00197870d10b132dcf34f /lib/chef/resource.rb
parent6257a566101870a5734edae03197c5b32b953773 (diff)
downloadchef-5caef70b1307d7d099c2621dc9ff7a4c0b3268d6.tar.gz
Supporting multiple actions
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r--lib/chef/resource.rb22
1 files changed, 16 insertions, 6 deletions
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)