summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/chef_client_config.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/chef/resource/chef_client_config.rb b/lib/chef/resource/chef_client_config.rb
index 1c94397587..c2c8c15b21 100644
--- a/lib/chef/resource/chef_client_config.rb
+++ b/lib/chef/resource/chef_client_config.rb
@@ -250,9 +250,16 @@ class Chef
introduced: "17.8"
action :create, description: "Create a client.rb config file for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
- [new_resource.config_directory, new_resource.log_location, new_resource.file_backup_path, new_resource.file_cache_path].each do |dir_path|
- next if ::Dir.exist?(new_resource.config_directory)
+ [
+ new_resource.config_directory,
+ new_resource.log_location,
+ new_resource.file_backup_path,
+ new_resource.file_cache_path,
+ ::File.join(new_resource.config_directory, "client.d"),
+ ::File.dirname(new_resource.pid_file)
+ ].each do |dir_path|
next if dir_path.nil?
+ next if ::Dir.exist?(dir_path)
directory dir_path do
user new_resource.user unless new_resource.user.nil?
group new_resource.group unless new_resource.group.nil?
@@ -261,15 +268,6 @@ class Chef
end
end
- unless ::Dir.exist?(::File.join(new_resource.config_directory, "client.d"))
- directory ::File.join(new_resource.config_directory, "client.d") do
- user new_resource.user unless new_resource.user.nil?
- group new_resource.group unless new_resource.group.nil?
- mode "0750"
- recursive true
- end
- end
-
template ::File.join(new_resource.config_directory, "client.rb") do
source ::File.expand_path("support/client.erb", __dir__)
user new_resource.user unless new_resource.user.nil?