From e738981089accbfb39bad1cb313281d966c07ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Oct 2022 01:20:53 +0200 Subject: Rewrote filter system. --- manifests/init.pp | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index 62cb2a3..bbd8edb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,6 +1,6 @@ class cgit ( String $root = '/var/www/cgit', - String $filterpath = '/usr/lib/cgit/extra-filters', + String $filterpath = '/usr/lib/cgit/puppet-controlled-filters', String $root_title, String $root_desc, String $root_readme_source = "puppet:///modules/${module_name}/root_readme", @@ -20,6 +20,8 @@ class cgit ( Optional[String] $server_name = undef, Optional[String] $certname = undef, String $htpasswd = '/var/lib/nginx/cgit-htpasswd', + String $cgitrc = '/etc/cgitrc', + Hash[String, Hash] $filters = {}, ) { # TODO figure out where CSS comes from @@ -29,11 +31,24 @@ class cgit ( 'cgit', ], { ensure => installed }) - file { '/etc/cgitrc': - ensure => file, - content => epp('cgit/cgitrc.epp'), + + concat { $cgitrc: + ensure => present, + } + concat::fragment { 'cgit config upper half': + order => 0, + content => epp('cgit/upper.epp'), + target => $::cgit::cgitrc, + } + + concat::fragment { 'cgit config lower half': + order => 99, + content => epp('cgit/lower.epp'), + target => $::cgit::cgitrc, } + create_resources(git::filter, $filters) + file { "${root}/logo": ensure => directory, } @@ -71,30 +86,7 @@ class cgit ( } } - file { dirname($filterpath): - ensure => directory, - } - file { $filterpath: - ensure => directory, - } - - [$about_filter, $source_filter].each |$f| { - file { "${filterpath}/${f}": - ensure => file, - source => "puppet:///modules/cgit/filters/${f}", - mode => stdlib::extname($f) ? { - '.lua' => '0444', - default => '0555', - }, - } - } - - file { "${filterpath}/${auth_filter}": - ensure => file, - content => epp("cgit/${auth_filter}.epp"), - mode => '0444', - } if $manage_server { if $server_name == undef { -- cgit v1.2.3