projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kill munin-update jobs older than 2 hours
[mirror/dsa-puppet.git]
/
modules
/
apache2
/
manifests
/
site.pp
diff --git
a/modules/apache2/manifests/site.pp
b/modules/apache2/manifests/site.pp
index
3429238
..
2a7257b
100644
(file)
--- a/
modules/apache2/manifests/site.pp
+++ b/
modules/apache2/manifests/site.pp
@@
-1,14
+1,20
@@
define apache2::site (
define apache2::site (
- $
config =
undef,
- $
template =
undef,
- $ensure
=
present,
- $site
=
undef
+ $
source=
undef,
+ $
content=
undef,
+ $ensure
=
present,
+ $site
=
undef
) {
include apache2
) {
include apache2
- if ! ($config or $template) {
- err ( "No configuration found for ${name}" )
+ case $ensure {
+ present: {
+ if ! ($source or $content) {
+ fail ( "No configuration found for ${name}" )
+ }
+ }
+ absent: {}
+ default: { fail ( "Unknown ensure value: '$ensure'" ) }
}
if $site {
}
if $site {
@@
-21,36
+27,46
@@
define apache2::site (
$link_target = $ensure ? {
present => $target,
$link_target = $ensure ? {
present => $target,
- absent => absent,
- default => err ( "Unknown ensure value: '$ensure'" ),
+ absent => absent
}
}
- if $
template
{
+ if $
content
{
file { $target:
ensure => $ensure,
file { $target:
ensure => $ensure,
- content =>
template($template)
,
+ content =>
$content
,
require => Package['apache2'],
require => Package['apache2'],
- notify =>
Service['apache2
'],
+ notify =>
Exec['service apache2 reload
'],
}
} else {
file { $target:
ensure => $ensure,
}
} else {
file { $target:
ensure => $ensure,
- source => $
config
,
+ source => $
source
,
require => Package['apache2'],
require => Package['apache2'],
- notify =>
Service['apache2
'],
+ notify =>
Exec['service apache2 reload
'],
}
}
}
}
- if $ensure == present {
+ if $::lsbmajdistrelease <= 7 {
+ $symlink = "/etc/apache2/sites-enabled/${name}"
+ } else {
+ $symlink = "/etc/apache2/sites-enabled/${name}.conf"
+
file { "/etc/apache2/sites-enabled/${name}":
file { "/etc/apache2/sites-enabled/${name}":
+ ensure => absent,
+ notify => Exec['service apache2 reload'],
+ }
+ }
+
+ if $ensure == present {
+ file { $symlink:
ensure => link,
target => $link_target,
ensure => link,
target => $link_target,
- notify
=> Service['apache2
'],
+ notify
=> Exec['service apache2 reload
'],
}
} else {
}
} else {
- file {
"/etc/apache2/sites-enabled/${name}"
:
+ file {
$symlink
:
ensure => absent,
ensure => absent,
- notify
=> Service['apache2
'],
+ notify
=> Exec['service apache2 reload
'],
}
}
}
}
}
}