aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2007-11-04 23:44:54 +0000
committerMicah Anderson <micah@riseup.net>2007-11-04 23:44:54 +0000
commitfc0da24919241c2b2d2bff95ccad4bbd9707d0ca (patch)
tree98fd2c7ae9874659c26fb9b394f05e19a14798b3
parent8f5d93bd69d40f701190f8dd39355be8e9848819 (diff)
downloadpuppet-virtual-fc0da24919241c2b2d2bff95ccad4bbd9707d0ca.tar.gz
puppet-virtual-fc0da24919241c2b2d2bff95ccad4bbd9707d0ca.tar.bz2
add an alias for the present option and add a delete option
also move the order so it is consistant
-rw-r--r--manifests/vserver.pp44
1 files changed, 31 insertions, 13 deletions
diff --git a/manifests/vserver.pp b/manifests/vserver.pp
index 105d5e3..968e949 100644
--- a/manifests/vserver.pp
+++ b/manifests/vserver.pp
@@ -33,7 +33,7 @@ define vs_create($in_domain, $legacy = false, $distro = 'etch') {
# ensure: present, stopped, running
-define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false) {
+define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false, $distro = '') {
case $in_domain { '': {}
default: { err("${fqdn}: vserver ${name} uses deprecated \$in_domain" ) }
@@ -48,9 +48,10 @@ define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false)
# TODO: wasn't there a syntax for using arrays as case selectors??
case $ensure {
- 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, } }
+ present: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, distro => $distro, } }
+ running: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, distro => $distro, } }
+ stopped: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, distro => $distro, } }
+ absent: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, distro => $distro, } }
default: { err("${fqdn}: vserver(${vs_name}): unknown ensure '${ensure}'") }
}
@@ -79,15 +80,16 @@ define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false)
}
case $ensure {
- stopped: {
- exec { "vserver ${vs_name} stop":
- onlyif => "test -e \$(readlink -f /etc/vservers/${vs_name}/run || echo /doesntexist )",
- require => Exec["vs_create_${vs_name}"],
- # fake the restart exec in the stopped case, so the dependencies are fulfilled
- alias => "vs_restart_${vs_name}",
- }
- file { $mark_file: ensure => absent, }
- }
+
+
+ present: {
+ # don't start or stop the vserver, just make sure it exists, we just run a dummy status test here
+ exec { "vserver ${vs_name} status":
+ require => Exec["vs_create_${vs_name}"],
+ alias => "vs_restart_${vs_name}",
+ }
+ }
+
running: {
exec { "vserver ${vs_name} start":
unless => "test -e \$(readlink -f /etc/vservers/${vs_name}/run)",
@@ -114,6 +116,22 @@ define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false)
}
}
}
+
+ stopped: {
+ exec { "vserver ${vs_name} stop":
+ onlyif => "test -e \$(readlink -f /etc/vservers/${vs_name}/run || echo /doesntexist )",
+ require => Exec["vs_create_${vs_name}"],
+ # fake the restart exec in the stopped case, so the dependencies are fulfilled
+ alias => "vs_restart_${vs_name}",
+ }
+ file { $mark_file: ensure => absent, }
+ }
+
+ absent: {
+ exec { "vserver ${vs_name} delete":
+ onlyif => "test -e \$(readlink -f /etc/vservers/${vs_name}/run || echo /doesntexist )",
+ }
+ }
}
}