summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Hemminger <hemminger@hotmail.com>2022-01-05 13:58:37 -0600
committerCorey Hemminger <hemminger@hotmail.com>2022-01-05 13:58:37 -0600
commit8f82ea2e228590e0a3fe13d313cd82855872360b (patch)
treeb92ec0ece75bb30c9162df06c67e71a6869d0c2e
parent0edab93f9e86ee2d72229c6ddf1f21c0444be582 (diff)
downloadchef-8f82ea2e228590e0a3fe13d313cd82855872360b.tar.gz
add changes from lamont's review
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
-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