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

Unified Diff: modules/adblockplus/manifests/web/mimeo.pp

Issue 29504594: #2687 - Include mimeo python module (Closed)
Patch Set: For comment 44 Created Aug. 22, 2017, 4:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « modules/adblockplus/files/mimeo.py ('k') | modules/adblockplus/templates/mimeo.service.erb » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplus/manifests/web/mimeo.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/manifests/web/mimeo.pp
@@ -0,0 +1,86 @@
+# == Class: adblockplus::web::mimeo
+#
+# Class adblockplus::web::mimeo registers the information received in a
+# http/s petition with an specified format in an specific output.
+#
+# === Parameters:
+#
+# [*format*]
+# A string containing the desired format for logging.
+#
+# '$remote_addr - - [$time_local] "$request" $status $bytes_sent "$http_referer"'
+#
+# [*port*]
+# An integer to setup the port where the script will be listening, defaults
+# to 8000.
+#
+# [*response*]
+# A string (like format parameter) representing the response sent to the
+# client.
+#
+class adblockplus::web::mimeo (
+ $format = '',
+ $port = 8000,
+ $response = '',
+){
+ include adblockplus
+
+ ensure_packages(['python3'])
+
+ realize(File['/var/adblockplus'])
+
+ file {'/var/adblockplus/mimeo':
+ ensure => 'directory',
+ mode => '0755',
+ owner => 'root',
+ require => File['/var/adblockplus'],
+ }
+
+ file {'/usr/local/bin/mimeo.py':
+ ensure => 'present',
+ owner => 'root',
+ group => 'root',
+ mode => 0755,
+ source => 'puppet:///modules/adblockplus/mimeo.py',
+ require => Package['python3'],
+ }
+
+ file {'/etc/systemd/system/mimeo.service':
+ ensure => 'present',
+ owner => 'root',
+ group => 'root',
+ mode => 0644,
+ content => template('adblockplus/mimeo.service.erb'),
+ require => File['/usr/local/bin/mimeo.py'],
+ }
+
+ Exec{
+ path => ['/usr/bin', '/bin'],
+ }
+
+ exec {'enable-service-mimeo':
+ command => 'systemctl enable mimeo.service',
+ user => 'root',
+ unless => 'systemctl is-enabled mimeo.service',
+ require => File['/etc/systemd/system/mimeo.service'],
+ }
+
+ service {'mimeo':
+ ensure => 'running',
+ hasrestart => false,
+ provider => 'systemd',
+ require => [
+ Exec['enable-service-mimeo'],
+ File['/var/adblockplus/mimeo'],
mathias 2017/08/22 17:30:58 The directory is an implicit dependency (via mimeo
+ ],
+ subscribe => File['/usr/local/bin/mimeo.py'],
+ }
+
+ exec {'reload-mimeo-daemon':
+ notify => Service['mimeo'],
+ command => 'systemctl daemon-reload',
+ subscribe => File['/etc/systemd/system/mimeo.service'],
+ refreshonly => true,
+ }
+}
+
« no previous file with comments | « modules/adblockplus/files/mimeo.py ('k') | modules/adblockplus/templates/mimeo.service.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld