aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/vserver.pp24
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}'") }
}