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 /manifests | |
parent | 68f7dc307e1ba12b5bbdabdc7d516de65981ec2e (diff) | |
download | puppet-git-2ead031c3e15ad1aeee4113be3250a74fa4bc766.tar.gz puppet-git-2ead031c3e15ad1aeee4113be3250a74fa4bc766.tar.bz2 |
Refactoring to use parametrized classes and hiera
Diffstat (limited to 'manifests')
-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 |
4 files changed, 21 insertions, 29 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" |