OLD | NEW |
1 # == Class: adblockplus::web::mimeo | 1 # == Class: adblockplus::web::mimeo |
2 # | 2 # |
3 # Class adblockplus::web::mimeo registers the information received in a | 3 # Class adblockplus::web::mimeo registers the information received in a |
4 # http/s petition with an specified format in an specific output. | 4 # http/s petition with an specified format in an specific output. |
5 # | 5 # |
6 # === Parameters: | 6 # === Parameters: |
7 # | 7 # |
8 # [*format*] | 8 # [*format*] |
9 # A string containing the desired format for logging. | 9 # A string containing the desired format for logging. |
10 # | 10 # |
11 # '$remote_addr - - [$time_local] "$request" $status $bytes_sent "$http_refere
r"' | 11 # '$remote_addr - - [$time_local] "$request" $status $bytes_sent "$http_refere
r"' |
12 # | 12 # |
13 # [*port*] | 13 # [*port*] |
14 # An integer to setup the port where the script will be listening, defaults | 14 # An integer to setup the port where the script will be listening, defaults |
15 # to 8000. | 15 # to 8000. |
16 # | 16 # |
17 # [*response*] | 17 # [*response*] |
18 # A string (like format parameter) representing the response sent to the | 18 # A string (like format parameter) representing the response sent to the |
19 # client. | 19 # client. |
20 # | 20 # |
| 21 # [*rotation*] |
| 22 # Overwrite the default log rotation configuration |
| 23 # |
21 class adblockplus::web::mimeo ( | 24 class adblockplus::web::mimeo ( |
22 $format = '', | 25 $format = '', |
23 $port = 8000, | 26 $port = 8000, |
24 $response = '', | 27 $response = '', |
| 28 $rotation = {}, |
25 ){ | 29 ){ |
26 include adblockplus | 30 include adblockplus |
27 | 31 |
28 ensure_packages(['python3']) | 32 ensure_packages(['python3']) |
29 | 33 |
30 realize(File['/var/adblockplus']) | 34 realize(File['/var/adblockplus']) |
31 | 35 |
32 file {'/var/adblockplus/mimeo': | 36 file {'/var/adblockplus/mimeo': |
33 ensure => 'directory', | 37 ensure => 'directory', |
34 mode => '0755', | 38 mode => '0755', |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 require => Exec['enable-service-mimeo'], | 76 require => Exec['enable-service-mimeo'], |
73 subscribe => File['/usr/local/bin/mimeo.py'], | 77 subscribe => File['/usr/local/bin/mimeo.py'], |
74 } | 78 } |
75 | 79 |
76 exec {'reload-mimeo-daemon': | 80 exec {'reload-mimeo-daemon': |
77 notify => Service['mimeo'], | 81 notify => Service['mimeo'], |
78 command => 'systemctl daemon-reload', | 82 command => 'systemctl daemon-reload', |
79 subscribe => File['/etc/systemd/system/mimeo.service'], | 83 subscribe => File['/etc/systemd/system/mimeo.service'], |
80 refreshonly => true, | 84 refreshonly => true, |
81 } | 85 } |
| 86 |
| 87 ensure_resource('logrotate::config', 'mimeo_data', merge({ |
| 88 content => join([ |
| 89 '/var/adblockplus/mimeo/data {', |
| 90 ' weekly', |
| 91 ' rotate 30', |
| 92 ' compress', |
| 93 ' missingok', |
| 94 ' nodateext', |
| 95 '}', |
| 96 ], "\n"), |
| 97 ensure => 'present', |
| 98 }, $rotation)) |
82 } | 99 } |
83 | 100 |
OLD | NEW |