From 89ea1faef90be8b0d5360dc20d77be4fa8393e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Zettergren?= Date: Mon, 11 Oct 2021 11:01:14 +0200 Subject: [PATCH] added condition to service property td-agent v4 does not ship /etc/init.d/td-agent file for distros that use systemd (ubuntu focal, for example maybe also others). This makes chef-client fail to run restart of service, since that was hardcoded to use init.d script. This adds a condistion to only set that property if the file actually esists. If it doesn't exist, then chefs service-mechanism will default to using whatever is available (systemd in this case) and the chef-run succeeds to restart the service properly. --- recipes/configure.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/configure.rb b/recipes/configure.rb index 326b9e8..be6a766 100644 --- a/recipes/configure.rb +++ b/recipes/configure.rb @@ -42,7 +42,7 @@ service "td-agent" do supports :restart => true, :reload => (reload_action == :reload), :status => true - restart_command "/etc/init.d/td-agent restart || /etc/init.d/td-agent start" + restart_command "/etc/init.d/td-agent restart || /etc/init.d/td-agent start" if ::File.exist?('/etc/init.d/td-agent') action [ :enable, :start ] end