diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-25 10:40:42 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-25 10:40:42 -0200 |
commit | 2ead031c3e15ad1aeee4113be3250a74fa4bc766 (patch) | |
tree | 3db141612ee7347d3ffb8562e99b191a34528954 | |
parent | 68f7dc307e1ba12b5bbdabdc7d516de65981ec2e (diff) | |
download | puppet-git-2ead031c3e15ad1aeee4113be3250a74fa4bc766.tar.gz puppet-git-2ead031c3e15ad1aeee4113be3250a74fa4bc766.tar.bz2 |
Refactoring to use parametrized classes and hiera
-rw-r--r-- | manifests/daemon.pp (renamed from manifests/git-daemon.pp) | 16 | ||||
-rw-r--r-- | manifests/git-manager.pp | 14 | ||||
-rw-r--r-- | manifests/gitweb.pp | 17 | ||||
-rw-r--r-- | manifests/init.pp | 3 | ||||
-rw-r--r-- | templates/gitweb.conf.erb | 4 |
5 files changed, 23 insertions, 31 deletions
diff --git a/manifests/git-daemon.pp b/manifests/daemon.pp index 5a5e4fb..546aae9 100644 --- a/manifests/git-daemon.pp +++ b/manifests/daemon.pp @@ -4,14 +4,26 @@ # # http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText -class git-daemon inherits git-manager { +class git::daemon ( + $implementation = hiera('git::daemon::implementation', 'gitolite') +) { + + case $implementation { + 'gitosis': { + include gitosis + } + default: { + include gitolite + } + } + # the needed packages and services include inetd # git-daemon config in inetd line { "git-daemon-inetd": file => "/etc/inetd.conf", - line => "git stream tcp nowait $git_server_implementation /usr/bin/git git daemon --inetd --verbose --base-path=/var/git/repositories /var/git/repositories", + line => "git stream tcp nowait ${implementation} /usr/bin/git git daemon --inetd --verbose --base-path=/var/git/repositories /var/git/repositories", ensure => present, } } diff --git a/manifests/git-manager.pp b/manifests/git-manager.pp deleted file mode 100644 index 52e546b..0000000 --- a/manifests/git-manager.pp +++ /dev/null @@ -1,14 +0,0 @@ -class git-manager { - case $git_server_implementation { - '': { $git_server_implementation = 'gitolite' } - } - - case $git_server_implementation { - 'gitosis': { - include gitosis - } - default: { - include gitolite - } - } -} diff --git a/manifests/gitweb.pp b/manifests/gitweb.pp index 045787d..1305390 100644 --- a/manifests/gitweb.pp +++ b/manifests/gitweb.pp @@ -1,19 +1,14 @@ # This class handles a gitweb installation. -class gitweb inherits git-manager { +class gitweb( + $protocol = hiera('git::web::protocol', 'git'), + $hosting_domain = hiera('git::web::hosting_domain', $::domain) + $implementation = hiera('git::daemon::implementation', 'gitolite') +) { + # the needed packages package { gitweb: ensure => installed } - $hosting_domain = $base_domain ? { - '' => $domain, - default => $base_domain, - } - - $base_url_protocol = $gitweb_protocol ? { - '' => 'git', - default => $gitweb_protocol, - } - # gitweb config file file { "/etc/gitweb.conf": owner => "root", diff --git a/manifests/init.pp b/manifests/init.pp index 09e9010..e3bd908 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,6 +3,5 @@ import "git.pp" import "gitosis.pp" import "gitweb.pp" -import "git-daemon.pp" -import "git-manager.pp" +import "daemon.pp" import "gitolite.pp" diff --git a/templates/gitweb.conf.erb b/templates/gitweb.conf.erb index cffe213..00f2053 100644 --- a/templates/gitweb.conf.erb +++ b/templates/gitweb.conf.erb @@ -13,7 +13,7 @@ $git_temp = "/tmp"; $home_text = "indextext.html"; # file with project list; by default, simply scan the projectroot dir. -$projects_list = "/var/git/<% if git_server_implementation == 'gitosis' %><%= git_server_implementation %>/<% end %>projects.list"; +$projects_list = "/var/git/<% if implementation == 'gitosis' %><%= implementation %>/<% end %>projects.list"; # stylesheet to use $stylesheet = "/gitweb.css"; @@ -25,4 +25,4 @@ $logo = "/git-logo.png"; $favicon = "/git-favicon.png"; # header url -@git_base_url_list = ('<%= base_url_protocol %>://git.<%= hosting_domain %>'); +@git_base_url_list = ('<%= protocol %>://git.<%= hosting_domain %>'); |