diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..d18efec
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,4 @@
+# DO NOT EDIT THIS FILE!
+# This file is managed by ModuleSync.
+
+* @ccin2p3/system
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index afd99bf..8290bab 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,9 +9,6 @@ on:
tags:
- '*'
-env:
- BUNDLE_WITHOUT: development:test:system_tests
-
jobs:
release:
name: Release
diff --git a/.gitignore b/.gitignore
index 9b95224..84fd904 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,23 +1,23 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-pkg/
-Gemfile.lock
-Gemfile.local
-vendor/
-.vendor/
-spec/fixtures/manifests/
-spec/fixtures/modules/
-.vagrant/
-.bundle/
-.ruby-version
-coverage/
-log/
-.idea/
-.dependencies/
-.librarian/
-Puppetfile.lock
+/pkg/
+/Gemfile.lock
+/Gemfile.local
+/vendor/
+/.vendor/
+/spec/fixtures/manifests/
+/spec/fixtures/modules/
+/.vagrant/
+/.bundle/
+/.ruby-version
+/coverage/
+/log/
+/.idea/
+/.dependencies/
+/.librarian/
+/Puppetfile.lock
*.iml
.*.sw?
-.yardoc/
-Guardfile
+/.yardoc/
+/Guardfile
diff --git a/.msync.yml b/.msync.yml
index a83abd9..b929160 100644
--- a/.msync.yml
+++ b/.msync.yml
@@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-modulesync_config_version: '5.1.0'
+modulesync_config_version: '6.0.0'
diff --git a/.pmtignore b/.pmtignore
index 65f5051..58a0408 100644
--- a/.pmtignore
+++ b/.pmtignore
@@ -1,37 +1,37 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-docs/
-pkg/
-Gemfile
-Gemfile.lock
-Gemfile.local
-vendor/
-.vendor/
-spec/
-Rakefile
-.vagrant/
-.bundle/
-.ruby-version
-coverage/
-log/
-.idea/
-.dependencies/
-.github/
-.librarian/
-Puppetfile.lock
+/docs/
+/pkg/
+/Gemfile
+/Gemfile.lock
+/Gemfile.local
+/vendor/
+/.vendor/
+/spec/
+/Rakefile
+/.vagrant/
+/.bundle/
+/.ruby-version
+/coverage/
+/log/
+/.idea/
+/.dependencies/
+/.github/
+/.librarian/
+/Puppetfile.lock
*.iml
-.editorconfig
-.fixtures.yml
-.gitignore
-.msync.yml
-.overcommit.yml
-.pmtignore
-.rspec
-.rspec_parallel
-.rubocop.yml
-.sync.yml
+/.editorconfig
+/.fixtures.yml
+/.gitignore
+/.msync.yml
+/.overcommit.yml
+/.pmtignore
+/.rspec
+/.rspec_parallel
+/.rubocop.yml
+/.sync.yml
.*.sw?
-.yardoc/
-.yardopts
-Dockerfile
+/.yardoc/
+/.yardopts
+/Dockerfile
diff --git a/.rubocop.yml b/.rubocop.yml
index aebb8e5..53ac189 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -4,9 +4,3 @@
inherit_gem:
voxpupuli-test: rubocop.yml
-
-Style/TrailingCommaInArguments:
- EnforcedStyleForMultiline: consistent_comma
-
-Style/WordArray:
- EnforcedStyle: brackets
diff --git a/.sync.yml b/.sync.yml
index e79c19a..006dfcc 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -4,3 +4,5 @@ spec/spec_helper.rb:
spec/default_facts.yml:
extra_facts:
path: "/bin:/usr/bin:/usr/local/bin"
+spec/spec_helper_acceptance.rb:
+ unmanaged: false
diff --git a/Gemfile b/Gemfile
index 04295a4..98a04cf 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,13 +1,13 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-source ENV['GEM_SOURCE'] || "https://rubygems.org"
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
group :test do
- gem 'voxpupuli-test', '~> 5.0', :require => false
+ gem 'voxpupuli-test', '~> 6.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
- gem 'puppet_metadata', '~> 1.0', :require => false
+ gem 'puppet_metadata', '~> 3.0', :require => false
end
group :development do
@@ -16,19 +16,19 @@ group :development do
end
group :system_tests do
- gem 'voxpupuli-acceptance', '~> 1.0', :require => false
+ gem 'voxpupuli-acceptance', '~> 2.0', :require => false
end
group :release do
- gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
- gem 'voxpupuli-release', '>= 1.2.0', :require => false
- gem 'puppet-strings', '>= 2.2', :require => false
+ gem 'github_changelog_generator', '>= 1.16.1', :require => false
+ gem 'voxpupuli-release', '~> 3.0', :require => false
+ gem 'faraday-retry', '~> 2.1', :require => false
end
gem 'rake', :require => false
gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test]
-puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0'
+puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24'
gem 'puppet', puppetversion, :require => false, :groups => [:test]
# vim: syntax=ruby
diff --git a/Rakefile b/Rakefile
index b0f2713..909e11e 100644
--- a/Rakefile
+++ b/Rakefile
@@ -24,6 +24,10 @@ end
begin
require 'voxpupuli/release/rake_tasks'
rescue LoadError
+ # voxpupuli-release not present
+else
+ GCGConfig.user = 'ccin2p3'
+ GCGConfig.project = 'puppet-patterndb'
end
desc "Run main 'test' task and report merged results to coveralls"
@@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do
end
end
-desc 'Generate REFERENCE.md'
-task :reference, [:debug, :backtrace] do |t, args|
- patterns = ''
- Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace])
-end
-
-begin
- require 'github_changelog_generator/task'
- require 'puppet_blacksmith'
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
- metadata = Blacksmith::Modulefile.new
- config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/
- config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module."
- config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
- config.user = 'ccin2p3'
- config.project = "puppet-#{metadata.metadata['name'].split('-').last}"
- end
-
- # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715
- require 'rbconfig'
- if RbConfig::CONFIG['host_os'] =~ /linux/
- task :changelog do
- puts 'Fixing line endings...'
- changelog_file = File.join(__dir__, 'CHANGELOG.md')
- changelog_txt = File.read(changelog_file)
- new_contents = changelog_txt.gsub(%r{\r\n}, "\n")
- File.open(changelog_file, "w") {|file| file.puts new_contents }
- end
- end
-
-rescue LoadError
-end
# vim: syntax=ruby
diff --git a/examples/OK_ltgt.pp b/examples/OK_ltgt.pp
index fd6f75e..5835b16 100644
--- a/examples/OK_ltgt.pp
+++ b/examples/OK_ltgt.pp
@@ -37,6 +37,6 @@
],
}
-create_resources('patterndb::simple::ruleset', hiera('patterndb::simple::ruleset',{},'patterndb'))
-create_resources('patterndb::simple::rule', hiera('patterndb::simple::rule',{},'patterndb'))
-#create_resources('patterndb::simple::action', hiera('patterndb::simple::action',{},'patterndb'))
+create_resources('patterndb::simple::ruleset', lookup('patterndb::simple::ruleset', undef, undef, {}))
+create_resources('patterndb::simple::rule', lookup('patterndb::simple::rule', undef, undef, {}))
+#create_resources('patterndb::simple::action', lookup('patterndb::simple::action', undef, undef, {}))
diff --git a/lib/puppet/parser/functions/hash2array.rb b/lib/puppet/parser/functions/hash2array.rb
index de64a6d..85157e3 100644
--- a/lib/puppet/parser/functions/hash2array.rb
+++ b/lib/puppet/parser/functions/hash2array.rb
@@ -5,7 +5,7 @@
#
module Puppet::Parser::Functions
- newfunction(:hash2array, type: :rvalue, doc: <<~EOS,
+ newfunction(:hash2array, type: :rvalue, doc: <<~EOS
This converts a hash to an array containing that hash. Empty argument
lists are converted to an empty array. Arrays are left untouched. Hashes are
converted to arrays of alternating keys and values. Strings throw an error.
diff --git a/lib/puppet/parser/functions/string2array.rb b/lib/puppet/parser/functions/string2array.rb
index 19ffd8f..6e87b17 100644
--- a/lib/puppet/parser/functions/string2array.rb
+++ b/lib/puppet/parser/functions/string2array.rb
@@ -5,7 +5,7 @@
#
module Puppet::Parser::Functions
- newfunction(:string2array, type: :rvalue, doc: <<~EOS,
+ newfunction(:string2array, type: :rvalue, doc: <<~EOS
This converts a string to an array containing that single element. Empty argument
lists are converted to an empty array. Arrays are left untouched. Hashes throw
an error
diff --git a/manifests/hiera.pp b/manifests/hiera.pp
index b24de02..328c846 100644
--- a/manifests/hiera.pp
+++ b/manifests/hiera.pp
@@ -4,18 +4,18 @@
) {
create_resources(
'patterndb::parser',
- hiera_hash("${prefix}::parser", {})
+ lookup("${prefix}::parser", default_value => {})
)
create_resources(
'patterndb::simple::ruleset',
- hiera_hash("${prefix}::ruleset",{})
+ lookup("${prefix}::ruleset", default_value => {})
)
create_resources(
'patterndb::simple::rule',
- hiera_hash("${prefix}::rule", {})
+ lookup("${prefix}::rule", default_value => {})
)
create_resources(
'patterndb::simple::action',
- hiera_hash("${prefix}::action", {})
+ lookup("${prefix}::action", default_value => {})
)
}
diff --git a/metadata.json b/metadata.json
index 6e4360b..9dac84b 100644
--- a/metadata.json
+++ b/metadata.json
@@ -10,11 +10,11 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
- "version_requirement": ">= 4.5.0 < 9.0.0"
+ "version_requirement": ">= 4.5.0 < 10.0.0"
},
{
"name": "puppetlabs/concat",
- "version_requirement": ">= 1.2.0 < 8.0.0"
+ "version_requirement": ">= 1.2.0 < 10.0.0"
}
],
"operatingsystem_support": [
@@ -62,7 +62,7 @@
"requirements": [
{
"name": "puppet",
- "version_requirement": ">= 6.1.0 < 8.0.0"
+ "version_requirement": ">= 7.0.0 < 9.0.0"
}
],
"description": "Module for managing patterndb (syslog-ng) configuration files on Linux",
diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb
index 84717f2..1459518 100644
--- a/spec/acceptance/class_spec.rb
+++ b/spec/acceptance/class_spec.rb
@@ -3,6 +3,47 @@
require 'spec_helper_acceptance'
describe 'patterndb class' do
+ before(:all) do
+ shell('puppet module install ccin2p3/syslog_ng')
+ shell('puppet module install puppetlabs/apt')
+ shell('puppet module install puppet/epel')
+ end
+
+ # Setup requirements
+ it_behaves_like 'an idempotent resource' do
+ let(:manifest) do
+ <<-PUPPET
+ if fact('os.family') == 'RedHat' {
+ class { 'epel':
+ }
+ Class['epel'] -> Class['syslog_ng']
+ }
+
+ if fact('os.family') == 'Debian' {
+ # Versions 4.3.0 and 4.3.1 (current) are broken on Debian
+ $version = '3.38.1-1'
+ } else {
+ $version = undef
+ }
+
+ class { 'syslog_ng':
+ manage_repo => true,
+ package_ensure => $version,
+ }
+
+ syslog_ng::config { 'version':
+ content => '@version: 3.38',
+ order => '02',
+ }
+
+ if fact('os.family') == 'Debian' {
+ syslog_ng::module { 'getent':
+ }
+ }
+ PUPPET
+ end
+ end
+
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
diff --git a/spec/acceptance/hieradata/common.yaml b/spec/acceptance/hieradata/common.yaml
deleted file mode 100644
index 092524e..0000000
--- a/spec/acceptance/hieradata/common.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-patterndb::ruleset:
- kernel:
- pubdate: "2019-05-24"
- id: 6bbe09f1411f7afe20d5fa511b9cca42e3d1ec28
- parser: sequence
- patterns:
- - kernel
-patterndb::rule:
- aa46e8f08cc8ce316a4c04dce747b9a960c0f353:
- ruleset: kernel
- ruleclass: sequence
- patterns:
- - '@ESTRING:appacct.program:[@@NUMBER:appacct.pid@]: segfault at @ESTRING:: @ip @ESTRING:: @sp @ESTRING:: @@ESTRING:appacct.status: @@NUMBER:appacct.errno@ in @ESTRING:appacct.rsname:[@@ESTRING::]@'
- examples:
- - program: kernel
- test_message: 'ipmi[371646]: segfault at 7fe368118000 ip 00007fe37f26465b sp 00007fe36e9a9818 error 4 in libc-2.17.so[7fe37f10f000+1c2000]'
- - program: kernel
- test_message: 'ipmi[424101]: segfault at 7fba900ed000 ip 00007fbaa437465f sp 00007fba96c2e818 error 4 in libc-2.17.so[7fbaa421f000+1c2000]'
- - program: kernel
- test_message: 'ipmi[28689]: segfault at 7f76400f6e78 ip 00007f7660f47d69 sp 00007f7653803818 error 4 in libc-2.17.so[7f7660df4000+1c2000]'
-
diff --git a/spec/defines/parser_spec.rb b/spec/defines/parser_spec.rb
index f20ff27..f847e2d 100644
--- a/spec/defines/parser_spec.rb
+++ b/spec/defines/parser_spec.rb
@@ -20,7 +20,7 @@
it {
is_expected.to contain_file('patterndb::file::default').with(
- 'ensure' => 'present',
+ 'ensure' => 'present'
).that_notifies('Exec[patterndb::merge::default]')
}
end
@@ -34,7 +34,7 @@
it {
is_expected.to contain_exec('patterndb::test::default').with(
- 'command' => %r{patterndb/default\.xml $}m,
+ 'command' => %r{patterndb/default\.xml $}m
)
}
end
@@ -42,13 +42,13 @@
context 'With optional syslog-ng module' do
let :params do
{
- syslogng_modules: ['foo', 'bar'],
+ syslogng_modules: %w[foo bar],
}
end
it {
is_expected.to contain_exec('patterndb::test::default').with(
- 'command' => %r{patterndb/default\.xml --module=foo --module=bar$}m,
+ 'command' => %r{patterndb/default\.xml --module=foo --module=bar$}m
)
}
end
@@ -60,13 +60,13 @@
it {
is_expected.to contain_exec('patterndb::test::default').with(
- 'command' => %r{patterndb/default\.xml $}m,
+ 'command' => %r{patterndb/default\.xml $}m
)
}
it {
is_expected.to contain_exec('patterndb::test::stage1').with(
- 'command' => %r{patterndb/stage1\.xml $}m,
+ 'command' => %r{patterndb/stage1\.xml $}m
)
}
end
@@ -79,7 +79,7 @@
it {
is_expected.to contain_exec('patterndb::test::default').with(
- 'command' => %r{patterndb/default\.xml --module=foo --module=bar$}m,
+ 'command' => %r{patterndb/default\.xml --module=foo --module=bar$}m
)
}
end
@@ -91,7 +91,7 @@
it {
is_expected.to contain_exec('patterndb::test::default').with(
- 'command' => %r{patterndb/default\.xml $}m,
+ 'command' => %r{patterndb/default\.xml $}m
)
}
end
diff --git a/spec/defines/raw_ruleset_spec.rb b/spec/defines/raw_ruleset_spec.rb
index 8ed0169..542e21d 100644
--- a/spec/defines/raw_ruleset_spec.rb
+++ b/spec/defines/raw_ruleset_spec.rb
@@ -46,7 +46,7 @@
it {
is_expected.to contain_file('BASEDIR/etc/syslog-ng/patterndb.d/default/myrawruleset').with(
- ensure: 'directory',
+ ensure: 'directory'
)
}
end
diff --git a/spec/defines/simple_action_spec.rb b/spec/defines/simple_action_spec.rb
index c90ea24..7a5ab10 100644
--- a/spec/defines/simple_action_spec.rb
+++ b/spec/defines/simple_action_spec.rb
@@ -40,7 +40,7 @@
context 'Simple invalid action with no rule' do
let :params do
default_params.merge(
- message: {},
+ message: {}
)
end
@@ -50,7 +50,7 @@
context 'Simple invalid action with no message' do
let :params do
default_params.merge(
- rule: 'myrule',
+ rule: 'myrule'
)
end
@@ -61,7 +61,7 @@
let :params do
default_params.merge(
message: {},
- rule: 'this_rule_was_not_predeclared',
+ rule: 'this_rule_was_not_predeclared'
)
end
@@ -73,9 +73,9 @@
default_params.merge(
message: {
'values' => { 'a' => 'A' },
- 'tags' => ['t', 'T'],
+ 'tags' => %w[t T],
},
- rule: 'myrule',
+ rule: 'myrule'
)
end
@@ -83,7 +83,7 @@
is_expected.to contain_patterndb__simple__ruleset('myruleset')
is_expected.to contain_patterndb__simple__rule('myrule')
is_expected.to contain_patterndb__simple__action('myaction').with(
- rule: 'myrule',
+ rule: 'myrule'
)
}
end
@@ -93,9 +93,9 @@
default_params.merge(
message: {
'values' => { 'a' => 'A' },
- 'tags' => ['t', 'T'],
+ 'tags' => %w[t T],
},
- rule: 'myembeddedrule',
+ rule: 'myembeddedrule'
)
end
@@ -103,7 +103,7 @@
is_expected.to contain_patterndb__simple__ruleset('myruleset')
is_expected.to contain_patterndb__simple__rule('myembeddedrule')
is_expected.to contain_patterndb__simple__action('myaction').with(
- rule: 'myembeddedrule',
+ rule: 'myembeddedrule'
)
}
end
diff --git a/spec/defines/simple_rule_spec.rb b/spec/defines/simple_rule_spec.rb
index 36d0be7..1f41e53 100644
--- a/spec/defines/simple_rule_spec.rb
+++ b/spec/defines/simple_rule_spec.rb
@@ -30,7 +30,7 @@
context 'Simple invalid rule with no patterns' do
let :params do
default_params.merge(
- ruleset: 'myruleset',
+ ruleset: 'myruleset'
)
end
@@ -40,7 +40,7 @@
context 'Simple invalid rule with no ruleset' do
let :params do
default_params.merge(
- patterns: ["Ford... you're turning into a penguin. Stop it."],
+ patterns: ["Ford... you're turning into a penguin. Stop it."]
)
end
@@ -51,7 +51,7 @@
let :params do
default_params.merge(
patterns: ["Ford... you're turning into a penguin. Stop it."],
- ruleset: 'this_ruleset_was_not_predeclared',
+ ruleset: 'this_ruleset_was_not_predeclared'
)
end
@@ -62,7 +62,7 @@
let :params do
default_params.merge(
patterns: ['Time is an illusion. Lunchtime doubly so.'],
- ruleset: 'myruleset',
+ ruleset: 'myruleset'
)
end
@@ -70,18 +70,18 @@
is_expected.to contain_patterndb__simple__ruleset('myruleset')
is_expected.to contain_patterndb__simple__rule('myrule').with(
ruleset: 'myruleset',
- patterns: ['Time is an illusion. Lunchtime doubly so.'],
+ patterns: ['Time is an illusion. Lunchtime doubly so.']
)
}
it {
is_expected.to contain_concat('patterndb_simple_ruleset-myruleset').with(
- path: '/BASEDIR/etc/syslog-ng/patterndb.d/default/myruleset.pdb',
+ path: '/BASEDIR/etc/syslog-ng/patterndb.d/default/myruleset.pdb'
)
is_expected.to contain_concat__fragment('patterndb_simple_rule-myrule-header').with(
- target: 'patterndb_simple_ruleset-myruleset',
+ target: 'patterndb_simple_ruleset-myruleset'
).with_content(
- %r{\s*Time is an illusion. Lunchtime doubly so.\s*}m,
+ %r{\s*Time is an illusion. Lunchtime doubly so.\s*}m
)
}
end
diff --git a/spec/defines/simple_ruleset_spec.rb b/spec/defines/simple_ruleset_spec.rb
index c569895..0c72cdd 100644
--- a/spec/defines/simple_ruleset_spec.rb
+++ b/spec/defines/simple_ruleset_spec.rb
@@ -27,13 +27,13 @@
context 'Simple ruleset without patterns' do
let :params do
default_params.merge(
- rules: [],
+ rules: []
)
end
it {
is_expected.to contain_patterndb__simple__ruleset('myruleset').with(
- parser: 'default',
+ parser: 'default'
)
}
end
@@ -47,13 +47,13 @@
'id' => 'RULE_1_ID',
'patterns' => [],
},
- ],
+ ]
)
end
it {
is_expected.to contain_patterndb__simple__ruleset('myruleset').with(
- parser: 'default',
+ parser: 'default'
)
}
@@ -62,7 +62,7 @@
it {
is_expected.to contain_concat('patterndb_simple_ruleset-myruleset').with('path' => '/BASEDIR/etc/syslog-ng/patterndb.d/default/myruleset.pdb')
is_expected.to contain_concat__fragment('patterndb_simple_ruleset-myruleset-header').with_content(
- %r{.*P1.*}m,
+ %r{.*P1.*}m
)
}
@@ -73,7 +73,7 @@
let :params do
default_params.merge(
patterns: [],
- rules: [],
+ rules: []
)
end
@@ -82,31 +82,31 @@
it {
is_expected.to contain_concat('patterndb_simple_ruleset-myruleset').with('path' => '/BASEDIR/etc/syslog-ng/patterndb.d/default/myruleset.pdb')
is_expected.to contain_concat('patterndb_simple_ruleset-myruleset').that_notifies(
- 'Exec[patterndb::merge::default]',
+ 'Exec[patterndb::merge::default]'
)
is_expected.to contain_concat__fragment('patterndb_simple_ruleset-myruleset-header').with_content(
- %r{}m,
+ %r{}m
)
}
it {
is_expected.to contain_concat__fragment('patterndb_simple_ruleset-myruleset-header').with_content(
- %r{generated by puppet}m,
+ %r{generated by puppet}m
)
}
it {
is_expected.not_to contain__fragment('patterndb_simple_ruleset-myruleset-header').with_content(
- %r{url='}m,
+ %r{url='}m
)
}
end
@@ -123,13 +123,13 @@
'id' => 'RULE_1_ID',
'patterns' => [],
},
- ],
+ ]
)
end
it {
is_expected.to contain_patterndb__simple__ruleset('myruleset').with(
- parser: 'PARSER',
+ parser: 'PARSER'
)
}
@@ -139,15 +139,15 @@
it {
is_expected.to contain_concat__fragment('patterndb_simple_ruleset-myruleset-header').with(
- 'target' => 'patterndb_simple_ruleset-myruleset',
+ 'target' => 'patterndb_simple_ruleset-myruleset'
)
}
it {
is_expected.to contain_concat__fragment('patterndb_simple_ruleset-myruleset-header').with_content(
- %r{DESCRIPTION}m,
+ %r{DESCRIPTION}m
).with_content(
- %r{URL}m,
+ %r{URL}m
)
}
end
@@ -155,7 +155,7 @@
context 'Simple ruleset with one rule and 2 examples' do
let :params do
default_params.merge(
- patterns: ['P1', 'P2'],
+ patterns: %w[P1 P2],
rules: [
{
'id' => 'RULE_1_ID',
@@ -205,7 +205,7 @@
},
],
}
- ],
+ ]
)
end
@@ -226,7 +226,7 @@
'provider' => 'PROVIDER',
'ruleclass' => 'RULECLASS',
'values' => { 'KEY_FOO' => 'VAL_FOO', 'KEY_BAZ' => 'VAL_BAZ' },
- 'tags' => ['TAG_FOO', 'TAG_BAR'],
+ 'tags' => %w[TAG_FOO TAG_BAR],
'context_id' => 'CTX_FOO',
'context_timeout' => 42,
'context_scope' => 'global',
@@ -245,48 +245,48 @@
},
],
},
- ],
+ ]
)
end
it {
is_expected.to contain_concat__fragment('patterndb_simple_rule-RULE_ID-header').with_content(
- %r{this is a log message where @ESTRING:key:=@@ANYSTRING:value@}m,
+ %r{this is a log message where @ESTRING:key:=@@ANYSTRING:value@}m
).with_content(
- %r{provider='PROVIDER'}m,
+ %r{provider='PROVIDER'}m
).with_content(
- %r{class='RULECLASS'}m,
+ %r{class='RULECLASS'}m
).with_content(
- %r{VAL_FOO},
+ %r{VAL_FOO}
).with_content(
- %r{VAL_BAZ},
+ %r{VAL_BAZ}
).with_content(
- %r{TAG_FOO},
+ %r{TAG_FOO}
).with_content(
- %r{TAG_BAR},
+ %r{TAG_BAR}
).with_content(
- %r{context-id='CTX_FOO'},
+ %r{context-id='CTX_FOO'}
).with_content(
- %r{context-scope='global'},
+ %r{context-scope='global'}
).with_content(
- %r{context-timeout='42'},
+ %r{context-timeout='42'}
).with_content(
- %r{},
+ %r{}
)
is_expected.to contain_concat__fragment('patterndb_simple_rule-RULE_ID-RULE_ID-0').with_content(
- %r{}m,
+ %r{}m
).with_content(
- %r{}m,
+ %r{}m
).with_content(
- %r{ "1"'.*}m,
+ %r{ "1"'.*}m
)
}
it {
is_expected.to contain_concat__fragment('patterndb_simple_rule-RULE_ID-RULE_ID-0').with_content(
- %r{.*.*.*.*MESSAGE_ACTION.*.*.*}m,
+ %r{.*.*.*.*MESSAGE_ACTION.*.*.*}m
).with_content(
- %r{.*.*.*.*TAG_ACTION.*.*.*}m,
+ %r{.*.*.*.*TAG_ACTION.*.*.*}m
)
}
@@ -298,7 +298,7 @@
default_params.merge(
patterns: ['P1'],
order: '123',
- rules: [],
+ rules: []
)
end
@@ -307,7 +307,7 @@
it {
is_expected.to contain_concat('patterndb_simple_ruleset-myruleset').with('path' => '/BASEDIR/etc/syslog-ng/patterndb.d/default/123myruleset.pdb')
is_expected.to contain_concat__fragment('patterndb_simple_ruleset-myruleset-header').with_content(
- %r{.*P1.*}m,
+ %r{.*P1.*}m
)
}
end
diff --git a/spec/setup_acceptance_node.pp b/spec/setup_acceptance_node.pp
deleted file mode 100644
index 30eaad6..0000000
--- a/spec/setup_acceptance_node.pp
+++ /dev/null
@@ -1,24 +0,0 @@
-if fact('os.family') == 'Debian' {
- # FIXME: https://github.com/puppetlabs/puppetlabs-apt/pull/1015
- ensure_packages('apt-transport-https')
- Package['apt-transport-https'] -> Class['apt::update']
-}
-if fact('os.family') == 'RedHat' {
- class { 'epel':
- }
- Class['epel'] -> Class['syslog_ng']
-}
-
-class { 'syslog_ng':
- manage_repo => true,
-}
-
-syslog_ng::config { 'version':
- content => '@version: 3.30',
- order => '02',
-}
-
-if fact('os.family') == 'Debian' {
- syslog_ng::module { 'getent':
- }
-}
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 5a6deb9..565248c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -13,6 +13,8 @@
require 'voxpupuli/test/spec_helper'
+add_mocked_facts!
+
if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml')))
facts&.each do |name, value|
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 7f973c9..2681792 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -5,13 +5,6 @@
require 'voxpupuli/acceptance/spec_helper_acceptance'
-configure_beaker do |host|
- # Needed for facter to fetch facts used by the apt module
- install_package(host, 'lsb-release') if fact_on(host, 'os.name') == 'Ubuntu'
-
- install_module_from_forge_on(host, 'ccin2p3/syslog_ng', '>= 0')
- install_module_from_forge_on(host, 'puppetlabs/apt', '>= 0 < 9.0.0')
- install_module_from_forge_on(host, 'puppet/epel', '>= 0')
-end
+configure_beaker(modules: :metadata)
Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }