Showing with 35 additions and 22 deletions.
  1. +6 −1 CHANGELOG.md
  2. +1 −0 README.md
  3. +6 −7 Rakefile
  4. +7 −7 manifests/config.pp
  5. +2 −0 manifests/init.pp
  6. +4 −4 metadata.json
  7. +8 −2 spec/classes/config_spec.rb
  8. +1 −1 templates/input.yml.erb
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ Changelog
=========

## Unreleased
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.5.0...HEAD)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.7.0...HEAD)

## [v4.7.0](https://github.com/pcfens/puppet-filebeat/tree/v4.7.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.6.0...v4.7.0)

- Add `extra_validation_options` when validating the config [\#265](https://github.com/pcfens/puppet-filebeat/pull/265)

## [v4.6.0](https://github.com/pcfens/puppet-filebeat/tree/v4.6.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.5.0...v4.6.0)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ Installs and configures filebeat.
- `inputs`: [Hash] or [Array] Inputs that will be created. Commonly used to create inputs using hiera
- `setup`: [Hash] Setup that will be created. Commonly used to create setup using hiera
- `xpack`: [Hash] XPack configuration to pass to filebeat
- `extra_validate_options`: [String] Extra command line options to pass to the configuration validation command.

### Private Classes

Expand Down
13 changes: 6 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,35 @@ if Bundler.rubygems.find_name('github_changelog_generator').any?
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
config.add_pr_wo_labels = true
config.issues = false
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
config.configure_sections = {
"Changed" => {
"prefix" => "### Changed",
"labels" => ["backwards-incompatible"],
},
"Added" => {
"prefix" => "### Added",
"labels" => ["feature", "enhancement"],
"labels" => ["enhancement", "feature"],
},
"Fixed" => {
"prefix" => "### Fixed",
"labels" => ["bugfix"],
"labels" => ["bug", "documentation", "bugfix"],
},
}
end
else
desc 'Generate a Changelog from GitHub'
task :changelog do
raise <<EOM
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
The changelog tasks depends on recent features of the github_changelog_generator gem.
Please manually add it to your .sync.yml for now, and run `pdk update`:
---
Gemfile:
optional:
':development':
- gem: 'github_changelog_generator'
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
version: '~> 1.15'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
EOM
end
end
Expand Down
14 changes: 7 additions & 7 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => $major_version ? {
'5' => "${filebeat::filebeat_path} -N -configtest -c %",
default => "${filebeat::filebeat_path} -c % test config",
'5' => "${filebeat::filebeat_path} ${filebeat::extra_validate_options} -N -configtest -c %",
default => "${filebeat::filebeat_path} ${filebeat::extra_validate_options} -c % test config",
},
}

Expand Down Expand Up @@ -132,7 +132,7 @@
'FreeBSD' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => '/usr/local/sbin/filebeat -N -configtest -c %',
default => '/usr/local/sbin/filebeat ${filebeat::extra_validate_options} -N -configtest -c %',
}

file {'filebeat.yml':
Expand Down Expand Up @@ -164,8 +164,8 @@
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => $major_version ? {
'5' => "${filebeat::filebeat_path} -N -configtest -c %",
default => "${filebeat::filebeat_path} -c % test config",
'5' => "${filebeat::filebeat_path} ${filebeat::extra_validate_options} -N -configtest -c %",
default => "${filebeat::filebeat_path} ${filebeat::extra_validate_options} -c % test config",
},
}

Expand Down Expand Up @@ -201,8 +201,8 @@
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => $major_version ? {
'7' => "\"${filebeat_path}\" test config -c \"%\"",
default => "\"${filebeat_path}\" -N -configtest -c \"%\"",
'7' => "\"${filebeat_path}\" ${filebeat::extra_validate_options} test config -c \"%\"",
default => "\"${filebeat_path}\" ${filebeat::extra_validate_options} -N -configtest -c \"%\"",
}
}

Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
# @param inputs_merge [Boolean] Whether $inputs should merge all hiera sources, or use simple automatic parameter lookup
# proxy_address [String] Proxy server to use for downloading files
# @param xpack [Hash] Configuration items to export internal stats to a monitoring Elasticsearch cluster
# @param extra_validate_options [String] Extra command line options to pass to the configuration validation command
class filebeat (
String $package_ensure = $filebeat::params::package_ensure,
Boolean $manage_repo = $filebeat::params::manage_repo,
Expand Down Expand Up @@ -102,6 +103,7 @@
Optional[String] $systemd_beat_log_opts_override = undef,
String $systemd_beat_log_opts_template = $filebeat::params::systemd_beat_log_opts_template,
String $systemd_override_dir = $filebeat::params::systemd_override_dir,
Optional[String] $extra_validate_options = undef,

) inherits filebeat::params {

Expand Down
8 changes: 4 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pcfens-filebeat",
"version": "4.6.0",
"version": "4.7.0",
"author": "pcfens",
"summary": "A module to install and manage the filebeat log shipper",
"license": "Apache-2.0",
Expand Down Expand Up @@ -109,7 +109,7 @@
"elasticsearch",
"elastic"
],
"pdk-version": "1.18.0",
"template-url": "pdk-default#1.18.0",
"template-ref": "tags/1.18.0-0-g095317c"
"pdk-version": "1.18.1",
"template-url": "pdk-default#1.18.1",
"template-ref": "tags/1.18.1-0-g3d2e75c"
}
10 changes: 8 additions & 2 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

case major_version
when 5
"#{path} -N -configtest -c %"
"#{path} -N -configtest -c %"
else
"#{path} -c % test config"
"#{path} -c % test config"
end
end

Expand All @@ -45,6 +45,12 @@
require: 'File[filebeat-config-dir]',
)
}
context 'with added extra_validate_options parameter' do
let(:pre_condition) { "class { 'filebeat': major_version => '#{major_version}', extra_validate_options => '--foo'}" }
it {
is_expected.to contain_file('filebeat.yml').with_validate_cmd(/filebeat --foo/)
}
end

it {
is_expected.to contain_file('filebeat-config-dir').with(
Expand Down
2 changes: 1 addition & 1 deletion templates/input.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
close_timeout: <%= @close_timeout %>
<%- end -%>
<%- end -%>
<%- # Everthing below this can be applied to any input. %>
<%- # Everything below this can be applied to any input. %>
<%- # https://www.elastic.co/guide/en/beats/filebeat/current/configuration-general-options.html#configuration-general %>
<%- if @fields.length > 0 -%>
fields:
Expand Down