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

Unified Diff: modules/adblockplus/manifests/telemetry/endpoint.pp

Issue 29329669: Issue 3261 - Introduce module adblockplus::telemetry (Closed)
Patch Set: Issue 3261 - Rename /submit/{filter-hit-statistics => adblockplus} Created Nov. 13, 2015, 9:29 a.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
Index: modules/adblockplus/manifests/telemetry/endpoint.pp
diff --git a/modules/adblockplus/manifests/telemetry/endpoint.pp b/modules/adblockplus/manifests/telemetry/endpoint.pp
new file mode 100644
index 0000000000000000000000000000000000000000..a22d7235615f7cfea841fd850b9f8c329e4d0f84
--- /dev/null
+++ b/modules/adblockplus/manifests/telemetry/endpoint.pp
@@ -0,0 +1,53 @@
+# == Type: adblockplus::telemetry::endpoint
+#
+# Manage POST endoints of the $adblockplus::telemetry::domain.
+#
+# === Parameters:
+#
+# [*ensure*]
+# Whether the endpoint should be 'present' or 'absent'/'purged'.
+#
+# [*location*]
+# The path to the endpoint within the $adblockplus::telemtry::domain,
+# i.e. https://telemetry.adblockplus.org/$location (defaults to /$name).
+#
+# [*name*]
+# Identifies the data file (i.e. /var/log/nginx/telemetry_log_$name).
+#
+# === Examples:
+#
+# adblockplus::telemetry::endpoint {'filter-hit-statistics':
+# ensure = 'present',
+# location = '/submit/filter-hit-statistics',
+# }
+#
+define adblockplus::telemetry::endpoint (
+ $ensure = 'present',
+ $location = "/$name",
+) {
+
+ include adblockplus::telemetry
+ include nginx
+
+ $ensure_presence = $ensure ? {
+ /^(absent|purged)$/ => 'absent',
+ default => 'present',
+ }
+
+ $id = "adblockplus::telemetry::endpoint#$name"
+ $logfile = "/var/log/nginx/telemetry_log_$name"
+
+ concat::fragment {$id:
+ content => template('adblockplus/telemetry/endpoint.conf.erb'),
+ ensure => $ensure_presence,
+ notify => Service['nginx'],
+ order => 4,
+ target => $adblockplus::telemetry::endpoints_config_name,
+ }
+
+ logrotate::config {$id:
+ content => template('adblockplus/telemetry/logrotate.erb'),
+ ensure => $ensure_presence,
+ name => "telemetry_$name",
+ }
+}
« no previous file with comments | « modules/adblockplus/manifests/telemetry.pp ('k') | modules/adblockplus/templates/telemetry/endpoint.conf.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld