From c2c13bdcc77300c3c7c36dfd4619805c93baae38 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Fri, 12 Apr 2024 21:19:37 +0200 Subject: [PATCH] Avoid deprecated systemd::service_limits `systemd::service_limits` was deprecated https://github.com/voxpupuli/puppet-systemd/pull/437 --- manifests/instance.pp | 8 +++++--- spec/classes/redis_spec.rb | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index 87bde750..e715c687 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -483,11 +483,13 @@ } } else { if $ulimit_managed { - systemd::service_limits { "${service_name}.service": - limits => { + systemd::manage_dropin { "${service_name}-90-limits.conf": + ensure => present, + unit => "${service_name}.service", + service_entry => { 'LimitNOFILE' => $ulimit, }, - restart_service => false, + notify_service => false, } } } diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 05ab11d7..dccf7a37 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -109,10 +109,10 @@ class { 'redis': is_expected.to contain_file("/etc/systemd/system/#{service_name}.service.d/limit.conf"). with_ensure('absent') - is_expected.to contain_systemd__service_limits("#{service_name}.service"). - with_limits({ 'LimitNOFILE' => 7777 }). - with_restart_service(false). - with_ensure('present') + is_expected.to contain_systemd__manage_dropin("#{service_name}-90-limits.conf"). + with_service_entry({ 'LimitNOFILE' => 7777 }). + with_ensure('present'). + with_unit("#{service_name}.service") end end