summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/chef_client_config.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/resource/chef_client_config.rb b/lib/chef/resource/chef_client_config.rb
index 7677de33d6..e02010a147 100644
--- a/lib/chef/resource/chef_client_config.rb
+++ b/lib/chef/resource/chef_client_config.rb
@@ -249,7 +249,7 @@ class Chef
description: "The data collector token to interact with the data collector server URL (Automate). Note: If possible, use Chef Infra Server to do all data collection reporting, as this removes the need to distribute tokens to individual nodes.",
introduced: "17.8"
- action :create, description: "Create a client.rb config file for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
+ action :create, description: "Create a client.rb config file and folders for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
[
new_resource.config_directory,
(::File.dirname(new_resource.log_location) unless new_resource.log_location.nil?),
@@ -257,14 +257,12 @@ class Chef
new_resource.file_cache_path,
::File.join(new_resource.config_directory, "client.d"),
(::File.dirname(new_resource.pid_file) unless new_resource.pid_file.nil?),
- ].each do |dir_path|
- next if dir_path.nil?
- next if ::Dir.exist?(dir_path)
+ ].compact.each do |dir_path|
directory dir_path do
user new_resource.user unless new_resource.user.nil?
group new_resource.group unless new_resource.group.nil?
- mode dir_path == ::File&.dirname(new_resource.log_location) ? "0755" : "0750"
+ mode dir_path == ::File.dirname(new_resource.log_location) ? "0755" : "0750"
recursive true
end
end