| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 class adblockplus::web::mimeo ( | 21 class adblockplus::web::mimeo ( |
| 22 $format = '', | 22 $format = '', |
| 23 $port = 8000, | 23 $port = 8000, |
| 24 $response = '', | 24 $response = '', |
| 25 ){ | 25 ){ |
| 26 include adblockplus | |
| 26 | 27 |
| 27 ensure_packages(['python3']) | 28 ensure_packages(['python3']) |
| 28 | 29 |
| 29 realize(File['/var/adblockplus']) | 30 realize(File['/var/adblockplus']) |
|
mathias
2017/08/21 20:07:38
Please explicitly include `adblockplus` when you r
f.lopez
2017/08/22 16:52:43
Done.
| |
| 30 | 31 |
| 31 file {'/var/adblockplus/mimeo': | 32 file {'/var/adblockplus/mimeo': |
| 32 ensure => 'directory', | 33 ensure => 'directory', |
| 33 mode => '0755', | 34 mode => '0755', |
| 34 owner => 'root', | 35 owner => 'root', |
| 35 require => File['/var/adblockplus'], | 36 require => File['/var/adblockplus'], |
| 36 } | 37 } |
| 37 | 38 |
| 38 file {'/usr/local/bin/mimeo.py': | 39 file {'/usr/local/bin/mimeo.py': |
| 39 ensure => 'present', | 40 ensure => 'present', |
| 40 owner => 'root', | 41 owner => 'root', |
| 41 group => 'root', | 42 group => 'root', |
| 42 mode => 0755, | 43 mode => 0755, |
| 43 source => 'puppet:///modules/adblockplus/mimeo.py', | 44 source => 'puppet:///modules/adblockplus/mimeo.py', |
| 44 require => [ | 45 require => Package['python3'], |
| 45 Package['python3'], | |
| 46 File['/var/adblockplus/mimeo'], | |
|
mathias
2017/08/21 20:07:38
The script does not depend on the path hard-coded
f.lopez
2017/08/22 16:52:43
Yeah, you are right, I wasn't sure about this tbh.
| |
| 47 ], | |
| 48 } | 46 } |
| 49 | 47 |
| 50 file {'/etc/systemd/system/mimeo.service': | 48 file {'/etc/systemd/system/mimeo.service': |
| 51 ensure => 'present', | 49 ensure => 'present', |
| 52 owner => 'root', | 50 owner => 'root', |
| 53 group => 'root', | 51 group => 'root', |
| 54 mode => 0644, | 52 mode => 0644, |
| 55 content => template('adblockplus/mimeo.service.erb'), | 53 content => template('adblockplus/mimeo.service.erb'), |
| 56 require => File['/usr/local/bin/mimeo.py'], | 54 require => File['/usr/local/bin/mimeo.py'], |
| 57 } | 55 } |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 76 } | 74 } |
| 77 | 75 |
| 78 exec {'reload-mimeo-daemon': | 76 exec {'reload-mimeo-daemon': |
| 79 notify => Service['mimeo'], | 77 notify => Service['mimeo'], |
| 80 command => 'systemctl daemon-reload', | 78 command => 'systemctl daemon-reload', |
| 81 subscribe => File['/etc/systemd/system/mimeo.service'], | 79 subscribe => File['/etc/systemd/system/mimeo.service'], |
| 82 refreshonly => true, | 80 refreshonly => true, |
| 83 } | 81 } |
| 84 } | 82 } |
| 85 | 83 |
| LEFT | RIGHT |