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

Unified Diff: modules/logstash/manifests/fragment.pp

Issue 29327588: Issue 2864 - Introduce class logstash (Closed)
Patch Set: Issue 2864 - Address feedback from code-review Created Oct. 20, 2015, 1:04 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/logstash/files/logstash.sh ('k') | modules/logstash/manifests/init.pp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/logstash/manifests/fragment.pp
diff --git a/modules/logstash/manifests/fragment.pp b/modules/logstash/manifests/fragment.pp
new file mode 100644
index 0000000000000000000000000000000000000000..90cee80a69bba7a1ccfa37f45b8b2d06dd658e18
--- /dev/null
+++ b/modules/logstash/manifests/fragment.pp
@@ -0,0 +1,67 @@
+# == Type: logstash::fragment
+#
+# Manage Logstash (https://logstash.net/) configuration file fragments.
+#
+# === Parameters:
+#
+# [*content*]
+# The configuration as-is, mutually exclusive with $source.
+#
+# [*ensure*]
+# Either 'present' or 'absent'.
+#
+# [*order*]
+# Any index for lexical odering of fragments within the generated file.
+#
+# [*source*]
+# The configuration source location, mutually exclusive with $content.
+#
+# [*target*]
+# The name or resource of the target pipeline configuration.
+#
+# === Examples:
+#
+# logstash::fragment {'input':
+# content => template('custom/pipeline-inputs.erb'),
+# order => 20,
+# target => Logstash::Pipeline['custom'],
+# }
+#
+# logstash::fragment {'filter':
+# content => template('custom/pipeline-filters.erb'),
+# order => 40,
+# target => Logstash::Pipeline['custom'],
+# }
+#
+# logstash::fragment {'output':
+# content => template('custom/pipeline-outputs.erb'),
+# order => 60,
+# target => Logstash::Pipeline['custom'],
+# }
+#
+define logstash::fragment(
+ $content = undef,
+ $ensure = 'present',
+ $order = 10,
+ $source = undef,
+ $target = 'default',
+) {
+
+ if is_string($target) {
+ $pipeline = Logstash::Pipeline[$target]
+ }
+ else {
+ $pipeline = $target
+ }
+
+ $pipeline_title = getparam($pipeline, 'title')
+ $pipeline_id = "logstash::pipeline#$pipeline_title"
+
+ concat::fragment {"logstash::fragment#$title":
+ content => $content,
+ ensure => $ensure,
+ order => $order,
+ source => $source,
+ target => $pipeline_id,
+ }
+}
« no previous file with comments | « modules/logstash/files/logstash.sh ('k') | modules/logstash/manifests/init.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld