diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-04-12 18:39:34 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-04-12 18:45:55 -0700 |
commit | 6607b130fe16fa9f28300548d01561d04da54eae (patch) | |
tree | 5a317c6e770683e3b99f177f4fbb3fe1346d32b6 /lib/chef/policy_builder | |
parent | 3a87c705090c7f44d51666c0bf88add9c2445e9a (diff) | |
download | chef-6607b130fe16fa9f28300548d01561d04da54eae.tar.gz |
Allow empty strings in -o to result in empty override run listlcg/empty-override-runlist
Previously this was not possible. Now you can do this:
```
chef-client -o "" ./foo.rb
```
And it will only run foo.rb and not any of the recipes in your
run_list at all. Node will not be saved at the end.
Useful to one-shot something like keyrotation (which still needs
keys and needs to talk to the chef server API, so this is a
different use case from simple chef-apply).
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/policy_builder')
-rw-r--r-- | lib/chef/policy_builder/expand_node_object.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb index dda4a2b4c3..eea5a37edd 100644 --- a/lib/chef/policy_builder/expand_node_object.rb +++ b/lib/chef/policy_builder/expand_node_object.rb @@ -214,7 +214,7 @@ class Chef # override_runlist was provided. Chef::Client uses this to decide whether # to do the final node save at the end of the run or not. def temporary_policy? - !node.override_runlist.empty? + node.override_runlist_set? end ######################################## @@ -222,9 +222,9 @@ class Chef ######################################## def setup_run_list_override - runlist_override_sanity_check! - unless override_runlist.empty? - node.override_runlist(*override_runlist) + unless override_runlist.nil? + runlist_override_sanity_check! + node.override_runlist = override_runlist Chef::Log.warn "Run List override has been provided." Chef::Log.warn "Original Run List: [#{node.primary_runlist}]" Chef::Log.warn "Overridden Run List: [#{node.run_list}]" |