 Issue 29504594:
  #2687 - Include mimeo python module  (Closed)
    
  
    Issue 29504594:
  #2687 - Include mimeo python module  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 # == Class: adblockplus::web::mimeo | |
| 2 # | |
| 3 # Class adblockplus::web::mimeo registers the information received in a | |
| 4 # http/s petition with an specified format in an specific output. | |
| 5 # | |
| 6 # === Parameters: | |
| 7 # | |
| 8 # [*format*] | |
| 9 # A string containing the desired format for logging. | |
| 10 # | |
| 11 # '$remote_addr - - [$time_local] "$request" $status $bytes_sent "$http_refere r"' | |
| 12 # | |
| 13 # [*port*] | |
| 14 # An integer to setup the port where the script will be listening, defaults | |
| 15 # to 8000. | |
| 16 # | |
| 17 # [*response*] | |
| 18 # A string (like format parameter) representing the response sent to the | |
| 19 # client. | |
| 20 # | |
| 21 # [*output*] | |
| 22 # A string containg the path to the file where the logs will be written. | |
| 23 # the special char `-` represents stdout. | |
| 24 # | |
| 25 class adblockplus::web::mimeo ( | |
| 26 $format = '', | |
| 27 $port = 8000, | |
| 28 $response = '', | |
| 29 $output = '-', | |
| 
mathias
2017/08/21 07:37:42
With that one being the default now, how exactly c
 
f.lopez
2017/08/21 19:54:12
Done.
 | |
| 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 source => 'puppet:///modules/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 => Exec["enable-service-mimeo"], | |
| 68 } | |
| 69 | |
| 70 exec {"reload-mimeo-daemon": | |
| 71 notify => Service['mimeo'], | |
| 72 command => 'systemctl daemon-reload', | |
| 73 subscribe => [ | |
| 74 File["/etc/systemd/system/mimeo.service"], | |
| 75 File["/usr/local/bin/mimeo.py"], | |
| 
mathias
2017/08/21 07:37:42
Why should changing the Python script require a da
 
f.lopez
2017/08/21 19:54:12
Done.
 | |
| 76 ], | |
| 77 refreshonly => true, | |
| 78 } | |
| 79 } | |
| 80 | |
| OLD | NEW |