diff options
author | Micah Anderson <micah@riseup.net> | 2007-11-04 22:41:42 +0000 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2007-11-04 22:41:42 +0000 |
commit | 5735a14ff250593b72b4f202b26c90b42df548e9 (patch) | |
tree | 399df350b8b9a0f50c41580465274e04ca6d9a73 /manifests/vserver.pp | |
parent | acc4a53384b23e5a350c6b2087323161f254ace2 (diff) | |
download | puppet-virtual-5735a14ff250593b72b4f202b26c90b42df548e9.tar.gz puppet-virtual-5735a14ff250593b72b4f202b26c90b42df548e9.tar.bz2 |
fixes to virtual module
Diffstat (limited to 'manifests/vserver.pp')
-rw-r--r-- | manifests/vserver.pp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/manifests/vserver.pp b/manifests/vserver.pp index d0236a6..2dd5ccb 100644 --- a/manifests/vserver.pp +++ b/manifests/vserver.pp @@ -20,8 +20,9 @@ class vserver::host { } -define vs_create($vs_name = $name, $context = $context) { - +define vs_create($in_domain, $legacy = false) { + + $vs_name = $legacy ? { true => $name, false => $in_domain ? { '' => $name, default => "${name}.${in_domain}" } } case $vs_name { '': { fail ( "Cannot create VServer with empty name" ) } } exec { "/usr/sbin/vserver ${vs_name} build -m debootstrap -- -d etch": @@ -32,17 +33,24 @@ define vs_create($vs_name = $name, $context = $context) { # ensure: present, stopped, running -define vserver($vs_name = $name, $ensure, $context, $mark = '') { - $if_dir = "/etc/vservers/${vs_name}/interfaces/" +define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false) { + + case $in_domain { '': {} + default: { err("${fqdn}: vserver ${name} uses deprecated \$in_domain" ) } + } + + $vs_name = $legacy ? { true => $name, false => $in_domain ? { '' => $name, default => "${name}.${in_domain}" } } + case $vs_name { '': { fail ( "Cannot create VServer with empty name" ) } } + + $if_dir = "/etc/vservers/${vs_name}/interfaces/" $mark_file = "/etc/vservers/${vs_name}/apps/init/mark" - case $vs_name { '': { fail ( "Cannot create VServer with empty name" ) } } # TODO: wasn't there a syntax for using arrays as case selectors?? case $ensure { - present: { vs_create{$name:} } - running: { vs_create{$name:} } - stopped: { vs_create{$name:} } + present: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, } } + running: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, } } + stopped: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, } } default: { err("${fqdn}: vserver(${vs_name}): unknown ensure '${ensure}'") } } |