diff --git a/manifests/config.pp b/manifests/config.pp index 840fec54f..24c89c5a1 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -221,14 +221,13 @@ } if $facts['systemd'] { # systemd fact provided by systemd module - systemd::service_limits { "${service_name}.service": + systemd::manage_dropin { 'service-90-limits.conf': + unit => "${service_name}.service", selinux_ignore_defaults => ($facts['os']['family'] == 'RedHat'), - limits => { + service_entry => { 'LimitNOFILE' => $file_limit, 'OOMScoreAdjust' => $oom_score_adj, }, - # The service will be notified when config changes - restart_service => false, } } diff --git a/metadata.json b/metadata.json index a0866e3e0..e480e6e1a 100644 --- a/metadata.json +++ b/metadata.json @@ -66,7 +66,7 @@ }, { "name": "puppet/systemd", - "version_requirement": ">= 2.10.0 < 8.0.0" + "version_requirement": ">= 4.0.0 < 8.0.0" } ], "tags": [ diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 41076ef6c..5fc0e814b 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -125,10 +125,9 @@ selinux_ignore_defaults = os_facts[:os]['family'] == 'RedHat' it do - is_expected.to contain_systemd__service_limits("#{name}.service"). + is_expected.to contain_systemd__manage_dropin('service-90-limits.conf'). with_selinux_ignore_defaults(selinux_ignore_defaults). - with_limits({ 'LimitNOFILE' => value, 'OOMScoreAdjust' => 0 }). - with_restart_service(false) + with_service_entry({ 'LimitNOFILE' => value, 'OOMScoreAdjust' => 0 }) end end end @@ -147,11 +146,7 @@ context "with oom_score_adj => '#{value}'", if: os_facts['systemd'] do let(:params) { { oom_score_adj: value } } - it do - is_expected.to contain_systemd__service_limits("#{name}.service"). - with_limits({ 'LimitNOFILE' => 16_384, 'OOMScoreAdjust' => value }). - with_restart_service(false) - end + it { is_expected.to contain_systemd__manage_dropin('service-90-limits.conf').with_service_entry({ 'LimitNOFILE' => 16_384, 'OOMScoreAdjust' => value }) } end end @@ -166,14 +161,11 @@ end context 'on systems with systemd', if: os_facts['systemd'] do - it do - is_expected.to contain_systemd__service_limits("#{name}.service"). - with_restart_service(false) - end + it { is_expected.to contain_systemd__manage_dropin('service-90-limits.conf') } end context 'on systems without systemd', unless: os_facts['systemd'] do - it { is_expected.not_to contain_systemd__service_limits("#{name}.service") } + it { is_expected.not_to contain_systemd__manage_dropin('service-90-limits.conf') } end context 'with admin_enable set to true' do