summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-01-08 00:43:07 +0100
committermh <mh@immerda.ch>2010-01-08 00:43:07 +0100
commit28b256e278bcb6d553c656071307f0516cb0fb48 (patch)
treea908c10af095ef762f791533520b5b65f674e3eb
parent7b1f9a68e95cd9dc877145eda08c18e233603bb8 (diff)
make it possible to set a webrepo to absent
-rw-r--r--manifests/web/repo.pp27
-rw-r--r--manifests/web/repo/lighttpd.pp21
2 files changed, 34 insertions, 14 deletions
diff --git a/manifests/web/repo.pp b/manifests/web/repo.pp
index def9f62..ce6ab15 100644
--- a/manifests/web/repo.pp
+++ b/manifests/web/repo.pp
@@ -2,6 +2,7 @@
# projectroot: where the git repos are listened
# projects_list: which repos to export
define git::web::repo(
+ $ensure = 'present',
$projectroot,
$projects_list,
$sitename='absent'
@@ -13,19 +14,29 @@ define git::web::repo(
default: { $gitweb_sitename = $sitename }
}
$gitweb_config = "/etc/gitweb.d/${name}.conf"
- file{"${gitweb_config}":
+ file{"${gitweb_config}": }
+ if $ensure == 'present' {
+ File["${gitweb_config}"]{
content => template("git/web/config")
+ }
+ } else {
+ File["${gitweb_config}"]{
+ ensure => absent,
+ }
}
case $gitweb_webserver {
'lighttpd': {
- git::web::repo::lighttpd{$name:
- gitweb_url => $gitweb_url,
- gitweb_config => $gitweb_config,
- }
+ git::web::repo::lighttpd{$name:
+ ensure => $ensure,
+ gitweb_url => $gitweb_url,
+ gitweb_config => $gitweb_config,
+ }
}
'apache': {
- apache::vhost::gitweb{$gitweb_url: }
- }
- default: { fail("no supported \$gitweb_webserver defined on ${fqdn}, so can't do git::web::repo: ${name}") }
+ apache::vhost::gitweb{$gitweb_url:
+ ensure => $ensure,
+ }
+ }
+ default: { fail("no supported \$gitweb_webserver defined on ${fqdn}, so can't do git::web::repo: ${name}") }
}
}
diff --git a/manifests/web/repo/lighttpd.pp b/manifests/web/repo/lighttpd.pp
index adc90e7..f740290 100644
--- a/manifests/web/repo/lighttpd.pp
+++ b/manifests/web/repo/lighttpd.pp
@@ -1,17 +1,26 @@
define git::web::repo::lighttpd(
+ ensure = 'present',
$gitweb_url,
$gitweb_config
){
+ file{"/etc/lighttpd/gitweb.d/${name}.conf": }
+ if $ensure == 'present' {
include git::web::lighttpd
- file{"/etc/lighttpd/gitweb.d/${name}.conf":
+ File["/etc/lighttpd/gitweb.d/${name}.conf"]{
content => template("git/web/lighttpd"),
notify => Service['lighttpd'],
owner => root, group => 0, mode => 0644;
}
- line{"add_include_of_gitwebrepo_${name}":
- line => "include \"gitweb.d/${name}.conf\"",
- file => "/etc/lighttpd/lighttpd-gitweb.conf",
- require => File['/etc/lighttpd/lighttpd-gitweb.conf'],
- notify => Service['lighttpd'],
+ } else {
+ File["/etc/lighttpd/gitweb.d/${name}.conf"]{
+ ensure => $ensure,
}
+ }
+ line{"add_include_of_gitwebrepo_${name}":
+ ensure => $ensure,
+ line => "include \"gitweb.d/${name}.conf\"",
+ file => "/etc/lighttpd/lighttpd-gitweb.conf",
+ require => File['/etc/lighttpd/lighttpd-gitweb.conf'],
+ notify => Service['lighttpd'],
+ }
}