diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-09-14 17:42:27 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-09-14 17:42:27 -0300 |
commit | c4a8cc27a870d1ec3cec1dc44548e2432bf85b33 (patch) | |
tree | d52c5264b8fbc2ef04d2118d7127691090363425 /manifests | |
parent | e09301fbe6407578844bee05faec08131a8efd80 (diff) | |
download | puppet-virtual-c4a8cc27a870d1ec3cec1dc44548e2432bf85b33.tar.gz puppet-virtual-c4a8cc27a870d1ec3cec1dc44548e2432bf85b33.tar.bz2 |
VServer sched files cannot have empty content
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/vserver.pp | 214 |
1 files changed, 135 insertions, 79 deletions
diff --git a/manifests/vserver.pp b/manifests/vserver.pp index 7d758f7..b21d3ca 100644 --- a/manifests/vserver.pp +++ b/manifests/vserver.pp @@ -399,52 +399,155 @@ define vs_sched($ensure = present, $fill_rate = '', $fill_rate2 = '', mode => 0755, } - file { "/etc/vservers/${name}/sched/fill-rate": - ensure => $ensure, - content => "$fill_rate\n", - require => File["/etc/vservers/${name}/sched"], + case $fill_rate { + '': { + file { "/etc/vservers/${name}/sched/fill-rate": + ensure => absent, + } + } + default: { + $set_fill_rate = "--fill-rate $fill_rate" + + file { "/etc/vservers/${name}/sched/fill-rate": + ensure => $ensure, + content => "$fill_rate\n", + require => File["/etc/vservers/${name}/sched"], + } + } } - file { "/etc/vservers/${name}/sched/fill-rate2": - ensure => $ensure, - content => "$fill_rate2\n", - require => File["/etc/vservers/${name}/sched"], + case $fill_rate2 { + '': { + file { "/etc/vservers/${name}/sched/fill-rate2": + ensure => absent, + } + } + default: { + $set_fill_rate2 = "--fill-rate2 $fill_rate2" + + file { "/etc/vservers/${name}/sched/fill-rate2": + ensure => $ensure, + content => "$fill_rate2\n", + require => File["/etc/vservers/${name}/sched"], + } + } } - file { "/etc/vservers/${name}/sched/interval": - ensure => $ensure, - content => "$interval\n", - require => File["/etc/vservers/${name}/sched"], + case $interval { + '': { + file { "/etc/vservers/${name}/sched/interval": + ensure => absent, + } + } + default: { + $set_interval = "--interval $interval" + + file { "/etc/vservers/${name}/sched/interval": + ensure => $ensure, + content => "$interval\n", + require => File["/etc/vservers/${name}/sched"], + } + } } - file { "/etc/vservers/${name}/sched/interval2": - ensure => $ensure, - content => "$interval2\n", - require => File["/etc/vservers/${name}/sched"], + case $interval2 { + '': { + file { "/etc/vservers/${name}/sched/interval2": + ensure => absent, + } + } + default: { + $set_interval2 = "--interval2 $interval2" + + file { "/etc/vservers/${name}/sched/interval2": + ensure => $ensure, + content => "$interval2\n", + require => File["/etc/vservers/${name}/sched"], + } + } } - file { "/etc/vservers/${name}/sched/tokens-min": - ensure => $ensure, - content => "$tokens_min\n", - require => File["/etc/vservers/${name}/sched"], + case $tokens_min { + '': { + file { "/etc/vservers/${name}/sched/tokens-min": + ensure => absent, + } + } + default: { + $set_tokens_min = "--tokens-min $tokens_min" + + file { "/etc/vservers/${name}/sched/tokens-min": + ensure => $ensure, + content => "$tokens_min\n", + require => File["/etc/vservers/${name}/sched"], + } + } } - file { "/etc/vservers/${name}/sched/tokens-max": - ensure => $ensure, - content => "$tokens_max\n", - require => File["/etc/vservers/${name}/sched"], + case $tokens_max { + '' { + file { "/etc/vservers/${name}/sched/tokens-max": + ensure => absent, + } + } + default: { + $set_tokens_max = "--tokens-max $tokens_max" + + file { "/etc/vservers/${name}/sched/tokens-max": + ensure => $ensure, + content => "$tokens_max\n", + require => File["/etc/vservers/${name}/sched"], + } + } } - file { "/etc/vservers/${name}/sched/tokens": - ensure => $ensure, - content => "$tokens\n", - require => File["/etc/vservers/${name}/sched"], + case $tokens { + '' { + file { "/etc/vservers/${name}/sched/tokens": + ensure => absent, + } + } + default: { + $set_tokens = "--tokens $tokens" + + file { "/etc/vservers/${name}/sched/tokens": + ensure => $ensure, + content => "$tokens\n", + require => File["/etc/vservers/${name}/sched"], + } + } } - file { "/etc/vservers/${name}/sched/priority-bias": - ensure => $ensure, - content => "$priority_bias\n", - require => File["/etc/vservers/${name}/sched"], + case $priority_bias { + '': { + file { "/etc/vservers/${name}/sched/priority-bias": + ensure => absent, + } + } + default: { + $set_priority_bias = "--prio-bias $priority_bias" + + file { "/etc/vservers/${name}/sched/priority-bias": + ensure => $ensure, + content => "$priority_bias\n", + require => File["/etc/vservers/${name}/sched"], + } + } + } + + case $idle_time { + true: { + $set_idle_time = "--idle-time" + + file { "/etc/vservers/${name}/sched/idle-time": + ensure => $ensure, + } + } + default: { + file { "/etc/vservers/${name}/sched/idle-time": + ensure => absent, + } + } } vs_cflags { "${name}-sched_hard": @@ -462,53 +565,6 @@ define vs_sched($ensure = present, $fill_rate = '', $fill_rate2 = '', case $ensure { present: { - if $fill_rate != '' { - $set_fill_rate = "--fill-rate $fill_rate" - } - - if $fill_rate2 != '' { - $set_fill_rate2 = "--fill-rate2 $fill_rate2" - } - - if $interval != '' { - $set_interval = "--interval $interval" - } - - if $interval2 != '' { - $set_interval2 = "--interval2 $interval2" - } - - if $tokens_min != '' { - $set_tokens_min = "--tokens-min $tokens_min" - } - - if $tokens_max != '' { - $set_tokens_max = "--tokens-max $tokens_max" - } - - if $tokens != '' { - $set_tokens = "--tokens $tokens" - } - - if $priority_bias != '' { - $set_priority_bias = "--prio-bias $priority_bias" - } - - case $idle_time { - true: { - $set_idle_time = "--idle-time" - - file { "/etc/vservers/${name}/sched/idle-time": - ensure => present, - } - } - default: { - file { "/etc/vservers/${name}/sched/idle-time": - ensure => absent, - } - } - } - $vsched_params = "$set_fill_rate $set_fill_rate2 $set_interval $set_interval2 $set_tokens_min $set_tokens_max $set_tokens $set_idle_time $set_priority_bias" exec { "vsched --xid `cat /etc/vservers/$name/context` ${vsched_params} --force": |