X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/52a5ec535e5a578e8450c94ac19a4e8681b88140..09b86cce66f00aec43bdb0b4b86421adfffe2cf4:/cookbooks/podman/resources/service.rb diff --git a/cookbooks/podman/resources/service.rb b/cookbooks/podman/resources/service.rb index 6ce5da35e..b48e04ce1 100644 --- a/cookbooks/podman/resources/service.rb +++ b/cookbooks/podman/resources/service.rb @@ -41,9 +41,19 @@ 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 + # FIXME: Ubuntu 22.04 podman/crun bug workaround "retries" 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 + retries 4 # Workaround https://github.com/containers/podman/issues/9752 + retry_delay 5 + 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