summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-07-19 13:07:54 -0700
committerTim Smith <tsmith@chef.io>2021-07-19 13:07:54 -0700
commit5b096a01fae7a28912a72e7e18655a881e15c000 (patch)
treefd3e25d64c498b04c636f5420b5fbaf3cde36e4e
parent53933b685ba5d00e4c21d98d30681e857f60597e (diff)
downloadchef-5b096a01fae7a28912a72e7e18655a881e15c000.tar.gz
chef_client_config: Add the ability to set policy_persist_run_list
Make this super simple to enable. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/chef_client_config.rb9
-rw-r--r--lib/chef/resource/support/client.erb3
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/resource/chef_client_config.rb b/lib/chef/resource/chef_client_config.rb
index 770aedf442..bd4ccbc478 100644
--- a/lib/chef/resource/chef_client_config.rb
+++ b/lib/chef/resource/chef_client_config.rb
@@ -29,7 +29,7 @@ class Chef
examples <<~DOC
**Bare minimum #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
- The absolute minimum configuration necessary for a node to communicate with the Infra Server is the URL of the Infra Server. All other configuration options either have values at the server side (Policyfiles, Roles, Environments, etc) or have default values determined at client startup.
+ The absolute minimum configuration necessary for a node to communicate with the #{ChefUtils::Dist::Server::PRODUCT} is the URL of the #{ChefUtils::Dist::Server::PRODUCT}. All other configuration options either have values at the server side (Policyfiles, Roles, Environments, etc) or have default values determined at client startup.
```ruby
chef_client_config 'Create client.rb' do
@@ -184,6 +184,10 @@ class Chef
coerce: proc { |x| x.map { |v| string_to_symbol(v).capitalize } },
default: []
+ property :policy_persist_run_list, [true, false],
+ description: "Override run lists defined in a Policyfile with the `run_list` defined on the #{ChefUtils::Dist::Server::PRODUCT}.",
+ introduced: "17.3"
+
property :minimal_ohai, [true, false],
description: "Run a minimal set of Ohai plugins providing data necessary for the execution of #{ChefUtils::Dist::Infra::PRODUCT}'s built-in resources. Setting this to true will skip many large and time consuming data sets such as `cloud` or `packages`. Setting this this to true may break cookbooks that assume all Ohai data will be present."
@@ -277,7 +281,8 @@ class Chef
report_handlers: format_handler(new_resource.report_handlers),
ssl_verify_mode: new_resource.ssl_verify_mode,
start_handlers: format_handler(new_resource.start_handlers),
- additional_config: new_resource.additional_config
+ additional_config: new_resource.additional_config,
+ policy_persist_run_list: new_resource.policy_persist_run_list
)
mode "0640"
action :create
diff --git a/lib/chef/resource/support/client.erb b/lib/chef/resource/support/client.erb
index 69faf0fcf6..0a0db02249 100644
--- a/lib/chef/resource/support/client.erb
+++ b/lib/chef/resource/support/client.erb
@@ -18,7 +18,8 @@
@pid_file
@policy_group
@policy_name
- @ssl_verify_mode).each do |prop| -%>
+ @ssl_verify_mode
+ @policy_persist_run_list).each do |prop| -%>
<% next if instance_variable_get(prop).nil? || instance_variable_get(prop).empty? -%>
<%=prop.delete_prefix("@") %> <%= instance_variable_get(prop).inspect %>
<% end -%>