From 915c94e5b3f44f231a5e3237385bbc2e164d7b88 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Mon, 13 Jan 2025 13:14:56 +0000 Subject: [PATCH] podman: support custom command --- cookbooks/podman/resources/service.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cookbooks/podman/resources/service.rb b/cookbooks/podman/resources/service.rb index 5ef0b5885..d9a328192 100644 --- a/cookbooks/podman/resources/service.rb +++ b/cookbooks/podman/resources/service.rb @@ -27,6 +27,7 @@ property :image, String, :required => true property :ports, Hash, :default => {} property :environment, Hash, :default => {} property :volume, Hash, :default => {} +property :command, String, :default => "" action :create do systemd_service new_resource.service do @@ -35,7 +36,11 @@ action :create do notify_access "all" environment "PODMAN_SYSTEMD_UNIT" => "%n" exec_start_pre "/bin/rm --force %t/%n.ctr-id" - exec_start "/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --userns=auto --label=io.containers.autoupdate=registry --pids-limit=-1 #{publish_options} #{environment_options} #{volume_options} --rm --sdnotify=conmon --detach --replace --name=%N #{new_resource.image}" + exec_start "/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon "\ + "--userns=auto --label=io.containers.autoupdate=registry "\ + "--pids-limit=-1 #{publish_options} #{environment_options} "\ + "#{volume_options} --rm --sdnotify=conmon --detach --replace "\ + "--name=%N #{new_resource.image} #{new_resource.command}" exec_stop "/usr/bin/podman stop --ignore --time=10 --cidfile=%t/%n.ctr-id" exec_stop_post "/usr/bin/podman rm --force --ignore --cidfile=%t/%n.ctr-id" timeout_start_sec 180 -- 2.39.5