From f41367c89145af7c81d58bc7401eda18d4c53803 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 12 Sep 2010 20:38:36 -0300 Subject: Deriving vserver name from $name at vs_sched and vs_cflags --- manifests/vserver.pp | 62 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'manifests') diff --git a/manifests/vserver.pp b/manifests/vserver.pp index 0848b48..63c1080 100644 --- a/manifests/vserver.pp +++ b/manifests/vserver.pp @@ -388,51 +388,51 @@ define vs_ip_binding($vserver, $ip, $ensure) { } } -define vs_sched($vserver, $ensure = present, $fill_rate = '', $fill_rate2 = '', +define vs_sched($ensure = present, $fill_rate = '', $fill_rate2 = '', $interval = '', $interval2 = '', $tokens_min = '', $tokens_max = '', $tokens = '', $idle_time = false, $priority_bias = '') { - file { "/etc/vservers/${vserver}/sched/fill-rate": + file { "/etc/names/${name}/sched/fill-rate": ensure => $ensure, content => "$fill_rate\n", } - file { "/etc/vservers/${vserver}/sched/fill-rate2": + file { "/etc/names/${name}/sched/fill-rate2": ensure => $ensure, content => "$fill_rate2\n", } - file { "/etc/vservers/${vserver}/sched/interval": + file { "/etc/names/${name}/sched/interval": ensure => $ensure, content => "$interval\n", } - file { "/etc/vservers/${vserver}/sched/interval2": + file { "/etc/names/${name}/sched/interval2": ensure => $ensure, content => "$interval2\n", } - file { "/etc/vservers/${vserver}/sched/tokens-min": + file { "/etc/names/${name}/sched/tokens-min": ensure => $ensure, content => "$tokens_min\n", } - file { "/etc/vservers/${vserver}/sched/tokens-max": + file { "/etc/names/${name}/sched/tokens-max": ensure => $ensure, content => "$tokens_max\n", } - file { "/etc/vservers/${vserver}/sched/tokens": + file { "/etc/names/${name}/sched/tokens": ensure => $ensure, content => "$tokens\n", } - file { "/etc/vservers/${vserver}/sched/priority-bias": + file { "/etc/names/${name}/sched/priority-bias": ensure => $ensure, content => "$priority_bias\n", } - vs_flags { "${vserver}-sched_hard": + vs_flags { "${name}-sched_hard": flag => "sched_hard", ensure => $ensure, } @@ -476,12 +476,12 @@ define vs_sched($vserver, $ensure = present, $fill_rate = '', $fill_rate2 = '', true: { $set_idle_time = "--idle-time" - file { "/etc/vservers/${vserver}/sched/idle-time": + file { "/etc/names/${name}/sched/idle-time": ensure => present, } } default: { - file { "/etc/vservers/${vserver}/sched/idle-time": + file { "/etc/names/${name}/sched/idle-time": ensure => absent, } } @@ -489,45 +489,45 @@ define vs_sched($vserver, $ensure = present, $fill_rate = '', $fill_rate2 = '', $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/$vserver/context` ${vsched_params} --force": - subscribe => File["/etc/vservers/$vserver/sched/fill_rate", "/etc/vservers/$vserver/sched/fill_rate2", - "/etc/vservers/$vserver/sched/interval", "/etc/vservers/$vserver/sched/interval2", - "/etc/vservers/$vserver/sched/tokens-min", "/etc/vservers/$vserver/sched/tokens-max", - "/etc/vservers/$vserver/sched/tokens", "/etc/vservers/$vserver/sched/idle-time"], + exec { "vsched --xid `cat /etc/names/$name/context` ${vsched_params} --force": + subscribe => File["/etc/names/$name/sched/fill_rate", "/etc/names/$name/sched/fill_rate2", + "/etc/names/$name/sched/interval", "/etc/names/$name/sched/interval2", + "/etc/names/$name/sched/tokens-min", "/etc/names/$name/sched/tokens-max", + "/etc/names/$name/sched/tokens", "/etc/names/$name/sched/idle-time"], refreshonly => true, - require => Exec["vs_create_${vserver}"], + require => Exec["vs_create_${name}"], } } } } -define vs_cflags($vserver, $flag, $ensure = present) { - if ! defined(File["/etc/vservers/${vserver}/cflags"]) { - file { "/etc/vservers/${vserver}/cflags": +define vs_cflags($flag, $ensure = present) { + if ! defined(File["/etc/names/${name}/cflags"]) { + file { "/etc/names/${name}/cflags": ensure => present, } } - line {"vs_cflags-${vserver}-${flag}": + line {"vs_cflags-${name}-${flag}": ensure => $ensure, - file => "/etc/vservers/${vserver}/cflags", + file => "/etc/names/${name}/cflags", line => "${flag}", - require => Exec["vs_create_${vserver}"], - notify => Exec["vattribute-${vserver}-${flag}"], + require => Exec["vs_create_${name}"], + notify => Exec["vattribute-${name}-${flag}"], } case $ensure { present: { - exec { "vattribute-${vserver}-${flag}": - command => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ${flag}", + exec { "vattribute-${name}-${flag}": + command => "vattribute --set --xid `cat /etc/names/$name/context` --flag ${flag}", refreshonly => true, - require => exec["vs_create_${vserver}"], + require => exec["vs_create_${name}"], } default: { - exec { "vattribute-${vserver}-${flag}": - command => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ~${flag}", + exec { "vattribute-${name}-${flag}": + command => "vattribute --set --xid `cat /etc/names/$name/context` --flag ~${flag}", refreshonly => true, - require => exec["vs_create_${vserver}"], + require => exec["vs_create_${name}"], } } } -- cgit v1.2.3