diff options
author | Thom May <tmay@expedia.com> | 2014-03-04 11:15:06 +0000 |
---|---|---|
committer | Thom May <tmay@expedia.com> | 2014-03-04 11:15:06 +0000 |
commit | ac7fcb41da4bbed8b2d02ae872b40639dfeb53c4 (patch) | |
tree | 15eb79c1a22971bad0714cf124a2dedc498ddc98 /lib/chef | |
parent | 96f82ac6a95356b3c3dc54306dfa020ea59829ff (diff) | |
download | chef-ac7fcb41da4bbed8b2d02ae872b40639dfeb53c4.tar.gz |
add run_list setter
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/node.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef/node.rb b/lib/chef/node.rb index f73628fdf5..623ca33842 100644 --- a/lib/chef/node.rb +++ b/lib/chef/node.rb @@ -261,13 +261,22 @@ class Chef args.length > 0 ? @override_runlist.reset!(args) : @override_runlist end + def select_run_list + @override_runlist.empty? ? @primary_runlist : @override_runlist + end + # Returns an Array of roles and recipes, in the order they will be applied. # If you call it with arguments, they will become the new list of roles and recipes. def run_list(*args) - rl = @override_runlist.empty? ? @primary_runlist : @override_runlist + rl = select_run_list args.length > 0 ? rl.reset!(args) : rl end + def run_list=(list) + rl = select_run_list + rl = list + end + # Returns true if this Node expects a given role, false if not. def run_list?(item) run_list.detect { |r| r == item } ? true : false |