From a69e02a9b5f577945c26c29bf67568efe29fa210 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Fri, 27 Jan 2023 14:36:07 +0000 Subject: [PATCH] systemd: add requires and array support for exec_stop --- cookbooks/systemd/resources/service.rb | 3 ++- cookbooks/systemd/templates/default/service.erb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cookbooks/systemd/resources/service.rb b/cookbooks/systemd/resources/service.rb index 1194d4fd6..9a2c69fa8 100644 --- a/cookbooks/systemd/resources/service.rb +++ b/cookbooks/systemd/resources/service.rb @@ -29,6 +29,7 @@ property :condition_path_exists_glob, [String, Array] property :after, [String, Array] property :conflicts, [String, Array] property :wants, [String, Array] +property :requires, [String, Array] property :joins_namespace_of, [String, Array] property :type, String, :is => %w[simple forking oneshot dbus notify idle] property :limit_nofile, Integer @@ -46,7 +47,7 @@ property :working_directory, String property :exec_start_pre, [String, Array] property :exec_start, [String, Array] property :exec_start_post, [String, Array] -property :exec_stop, String +property :exec_stop, [String, Array] property :exec_reload, String property :runtime_directory, String property :runtime_directory_mode, Integer diff --git a/cookbooks/systemd/templates/default/service.erb b/cookbooks/systemd/templates/default/service.erb index 858dbb327..0685a70ca 100644 --- a/cookbooks/systemd/templates/default/service.erb +++ b/cookbooks/systemd/templates/default/service.erb @@ -19,6 +19,9 @@ Conflicts=<%= Array(@conflicts).join(" ") %> <% if @wants -%> Wants=<%= Array(@wants).join(" ") %> <% end -%> +<% if @requires -%> +Requires=<%= Array(@requires).join(" ") %> +<% end -%> <% if @joins_namespace_of -%> JoinsNamespaceOf=<%= Array(@joins_namespace_of).join(" ") %> <% end -%> @@ -91,8 +94,10 @@ ExecStartPost=<%= exec_start_post %> <% if @dropin -%> ExecStop= <% end -%> +<% Array(@exec_stop).each do |exec_stop| -%> ExecStop=<%= @exec_stop %> <% end -%> +<% end -%> <% if @exec_reload -%> <% if @dropin -%> ExecReload= -- 2.39.5