From 3628f3113800d7f67b8f4e867bdc0e1307fa6488 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Mon, 12 Feb 2024 19:43:35 +0100 Subject: [PATCH] Support StartLimitIntervalSec and StartLimitBurst Allow `StartLimitIntervalSec` and `StartLimitBurst` to be set in the `[unit]` section of a managed drop or unit file. https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#StartLimitIntervalSec=interval --- REFERENCE.md | 2 ++ spec/type_aliases/systemd_unit_unit_spec.rb | 5 +++++ types/unit/unit.pp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/REFERENCE.md b/REFERENCE.md index c7841703..c81de631 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -2646,6 +2646,8 @@ Struct[{ Optional['ConditionPathExists'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]], Optional['ConditionPathIsDirectory'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]], Optional['ConditionPathIsMountPoint'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]], + Optional['StartLimitIntervalSec'] => String[1], + Optional['StartLimitBurst'] => Integer[1], }] ``` diff --git a/spec/type_aliases/systemd_unit_unit_spec.rb b/spec/type_aliases/systemd_unit_unit_spec.rb index 19e23b9a..f98edd55 100644 --- a/spec/type_aliases/systemd_unit_unit_spec.rb +++ b/spec/type_aliases/systemd_unit_unit_spec.rb @@ -114,4 +114,9 @@ it { is_expected.not_to allow_value({ 'RequiresMountsFor' => 'not/an/absolute/path' }) } it { is_expected.not_to allow_value({ 'RequiresMountsFor' => ['not/a/path'] }) } it { is_expected.not_to allow_value({ 'RequiresMountsFor' => [] }) } + + it { is_expected.to allow_value({ 'StartLimitIntervalSec' => '12 hours' }) } + it { is_expected.to allow_value({ 'StartLimitIntervalSec' => 'infinity' }) } + it { is_expected.to allow_value({ 'StartLimitBurst' => 5 }) } + it { is_expected.not_to allow_value({ 'StartLimitBurst' => '5' }) } end diff --git a/types/unit/unit.pp b/types/unit/unit.pp index 308643c9..3d41d324 100644 --- a/types/unit/unit.pp +++ b/types/unit/unit.pp @@ -42,5 +42,7 @@ Optional['ConditionPathExists'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]], Optional['ConditionPathIsDirectory'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]], Optional['ConditionPathIsMountPoint'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]], + Optional['StartLimitIntervalSec'] => String[1], + Optional['StartLimitBurst'] => Integer[1], } ]