diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2021-07-13 19:48:02 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2021-07-13 19:50:00 -0700 |
commit | 31c051b79dc17bf4687e35ac12a824f608598ff1 (patch) | |
tree | 6feec4714d6e3464b2f17fb011e45bcb0477f552 | |
parent | 735c459009dbb6a7a0844b8e716026154ede513f (diff) | |
download | chef-31c051b79dc17bf4687e35ac12a824f608598ff1.tar.gz |
Use a helper for determining if the manual run_list persists
Since I missed a clause in one check here, and it is duplicated,
it should probably be a helper method.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/policy_builder/policyfile.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb index f0b5767266..63d34a2afc 100644 --- a/lib/chef/policy_builder/policyfile.rb +++ b/lib/chef/policy_builder/policyfile.rb @@ -132,7 +132,7 @@ class Chef expand_run_list apply_policyfile_attributes - if node.run_list && Chef::Config[:policy_persist_run_list] + if persistent_run_list_set? Chef::Log.warn("The node.run_list setting is overriding the Policyfile run_list") end Chef::Log.info("Run List is [#{run_list}]") @@ -301,7 +301,7 @@ class Chef if json_attribs["run_list"] json_attribs["run_list"] - elsif Chef::Config[:policy_persist_run_list] && node.run_list && !node.run_list.empty? + elsif persistent_run_list_set? node.run_list elsif named_run_list_requested? named_run_list || raise(ConfigurationError, @@ -541,6 +541,10 @@ class Chef (policy["named_run_lists"] || {}).keys end + def persistent_run_list_set? + Chef::Config[:policy_persist_run_list] && node.run_list && !node.run_list.empty? + end + def named_run_list_requested? !!Chef::Config[:named_run_list] end |