From c6294e91397c6feebd9b9f0e33da615b3ca17998 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Fri, 27 Oct 2023 22:11:28 +0100 Subject: [PATCH] podman: avoid starting and immediate restart on first run --- cookbooks/podman/resources/service.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cookbooks/podman/resources/service.rb b/cookbooks/podman/resources/service.rb index 6ce5da35e..6052b7fb2 100644 --- a/cookbooks/podman/resources/service.rb +++ b/cookbooks/podman/resources/service.rb @@ -41,9 +41,16 @@ action :create do restart "on-failure" end + # No action :start here to avoid a start and then immediate :restart, due to subscribe, on first run service new_resource.service do - action [:enable, :start] - subscribes :restart, "systemd_service[#{new_resource.service}]" + action :enable + subscribes :restart, "systemd_service[#{new_resource.service}]", :immediately + end + + # Ensure the service is started if not running, replies on status of service resource + notify_group new_resource.service do + action :run + notifies :start, "service[#{new_resource.service}]", :immediately end end -- 2.45.1