From c0e5d64ad5c8cb80107b4898c2a181f7572de32d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 15 Aug 2012 17:54:32 -0300 Subject: Ensure that rlimit file just exist if value is not null --- manifests/vserver.pp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/manifests/vserver.pp b/manifests/vserver.pp index 5217206..52adace 100644 --- a/manifests/vserver.pp +++ b/manifests/vserver.pp @@ -641,7 +641,10 @@ define vs_rlimit($vserver, $limit, $soft = '', $hard = '', $min = '', $ensure = file { "/etc/vservers/${vserver}/rlimits/$limit.soft": mode => 0644, owner => root, group => root, content => "$soft\n", - ensure => $ensure, + ensure => $soft ? { + '' => absent, + default => $ensure, + }, require => File["/etc/vservers/${vserver}/rlimits"], notify => Exec["vs_restart_${vserver}"], } @@ -650,6 +653,10 @@ define vs_rlimit($vserver, $limit, $soft = '', $hard = '', $min = '', $ensure = mode => 0644, owner => root, group => root, content => "$hard\n", ensure => $ensure, + ensure => $hard ? { + '' => absent, + default => $ensure, + }, require => File["/etc/vservers/${vserver}/rlimits"], notify => Exec["vs_restart_${vserver}"], } @@ -657,7 +664,10 @@ define vs_rlimit($vserver, $limit, $soft = '', $hard = '', $min = '', $ensure = file { "/etc/vservers/${vserver}/rlimits/$limit.min": mode => 0644, owner => root, group => root, content => "$min\n", - ensure => $ensure, + ensure => $min? { + '' => absent, + default => $ensure, + }, require => File["/etc/vservers/${vserver}/rlimits"], notify => Exec["vs_restart_${vserver}"], } -- cgit v1.2.3