Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/adblockplus/manifests/web/mimeo.pp

Issue 29504594: #2687 - Include mimeo python module (Closed)
Patch Set: For comments 21 and 24 Created Aug. 13, 2017, 4:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # == Class: adblockplus::web::mimeo
2 #
3 # A [mimeograph](https://en.wikipedia.org/wiki/Mimeograph) (also known as stenci l duplicator) is a low-cost duplicating
4 # machine. Mimeo is used here since it is the abbreviation and it sounds better.
5 #
6 # The pourpose of this class is to log the information received in a http/s
7 # petition with an specified format.
8 # === Parameters:
9 #
10 # [*format*]
11 # A string containing the desired format for logging.
12 #
13 # '$remote_addr - - [$time_local] "$request" $status $bytes_sent "$http_refere r"'
14 #
15 # [*port*]
16 # An integer to setup the port where the script will be listening, defaults
17 # to 8000.
18 #
19 # [*response*]
20 # A string (like format parameter) representing the response sent to the
21 # client.
22 #
23 # [*log_file*]
24 # A string containg the path to the file where the logs will be written.
25 class adblockplus::web::mimeo (
26 $format = '',
27 $port = 8000,
28 $response = '',
29 $log_file = '/var/log/mimeo.log',
30 ){
31
32 ensure_packages(['python3'])
33
34 file {"/usr/local/bin/mimeo.py":
35 ensure => 'present',
36 owner => 'root',
37 group => 'root',
38 mode => 0755,
39 content => file('adblockplus/mimeo.py'),
40 require => Package['python3'],
41 }
42
43 file {"/etc/systemd/system/mimeo.service":
44 ensure => 'present',
45 owner => 'root',
46 group => 'root',
47 mode => 0644,
48 content => template('adblockplus/mimeo.service.erb'),
49 require => File['/usr/local/bin/mimeo.py'],
50 }
51
52 Exec{
53 path => ['/usr/bin', '/bin'],
54 }
55
56 exec {"enable-service-mimeo":
57 command => 'systemctl enable mimeo.service',
58 user => 'root',
59 unless => 'systemctl is-enabled mimeo.service',
60 require => File["/etc/systemd/system/mimeo.service"],
61 }
62
63 service {"mimeo":
64 ensure => 'running',
65 hasrestart => false,
66 provider => 'systemd',
67 require => [
68 Exec["enable-service-mimeo"],
69 Package["python3"],
70 ],
71 }
72
73 exec {"reload-mimeo-daemon":
74 command => 'systemctl daemon-reload',
75 subscribe => File["/etc/systemd/system/mimeo.service"],
76 refreshonly => true,
77 }
78 }
79
OLDNEW

Powered by Google App Engine
This is Rietveld