summaryrefslogtreecommitdiff
path: root/manifests/config
diff options
context:
space:
mode:
authorGabriel Filion <lelutin@gmail.com>2011-12-11 11:01:25 -0500
committerGabriel Filion <lelutin@gmail.com>2011-12-11 11:01:25 -0500
commit839e0ce62393d93034505664b873864ac08b5529 (patch)
treed611e508b4c8e922ee328b0702b0a7ac9215a888 /manifests/config
parent08f6c9b218893ea94b3611d687a56090e7fea5b2 (diff)
Avoid setting source or content when trying to remove apache::config::file
Currently, when trying to remove a config file that is not present in one of the source directories, you get an error about puppet not being able to find the file, which kills the puppet run. We need a special case for when $ensure is set to 'absent' or 'purged' so that we avoid setting the source argument. Signed-off-by: Gabriel Filion <lelutin@gmail.com>
Diffstat (limited to 'manifests/config')
-rw-r--r--manifests/config/file.pp58
1 files changed, 33 insertions, 25 deletions
diff --git a/manifests/config/file.pp b/manifests/config/file.pp
index ca741de..e04b631 100644
--- a/manifests/config/file.pp
+++ b/manifests/config/file.pp
@@ -31,38 +31,46 @@ define apache::config::file(
owner => root, group => 0, mode => 0644;
}
- if ($ensure == 'link') and ($target != false) {
- File["apache_${name}"] {
- target => $target,
+ case $ensure {
+ 'absent','purged': {
+ # We want to avoid all stuff related to source and content
}
- }
- else {
- case $content {
- 'absent': {
- $real_source = $source ? {
- 'absent' => [
- "puppet://${server}/modules/site-apache/${confdir}/${fqdn}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${apache_cluster_node}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${operatingsystem}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${name}",
- "puppet://${server}/modules/apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}",
- "puppet://${server}/modules/apache/${confdir}/${operatingsystem}/${name}",
- "puppet://${server}/modules/apache/${confdir}/${name}"
- ],
- default => $source,
- }
- File["apache_${name}"]{
- source => $real_source,
+ 'link': {
+ if $target != false {
+ File["apache_${name}"] {
+ target => $target,
}
}
- default: {
- File["apache_${name}"]{
- content => $content,
+ }
+ default: {
+ case $content {
+ 'absent': {
+ $real_source = $source ? {
+ 'absent' => [
+ "puppet://${server}/modules/site-apache/${confdir}/${fqdn}/${name}",
+ "puppet://${server}/modules/site-apache/${confdir}/${apache_cluster_node}/${name}",
+ "puppet://${server}/modules/site-apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}",
+ "puppet://${server}/modules/site-apache/${confdir}/${operatingsystem}/${name}",
+ "puppet://${server}/modules/site-apache/${confdir}/${name}",
+ "puppet://${server}/modules/apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}",
+ "puppet://${server}/modules/apache/${confdir}/${operatingsystem}/${name}",
+ "puppet://${server}/modules/apache/${confdir}/${name}"
+ ],
+ default => $source,
+ }
+ File["apache_${name}"]{
+ source => $real_source,
+ }
+ }
+ default: {
+ File["apache_${name}"]{
+ content => $content,
+ }
}
}
}
}
+
case $operatingsystem {
openbsd: { info("no package dependency on ${operatingsystem} for ${name}") }
default: {