Skip to content

Commit

Permalink
Merge pull request #40 from ccin2p3/puppet8
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex authored Aug 31, 2023
2 parents 038ea1d + a8153d6 commit da14b31
Show file tree
Hide file tree
Showing 24 changed files with 192 additions and 232 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DO NOT EDIT THIS FILE!
# This file is managed by ModuleSync.

* @ccin2p3/system
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
tags:
- '*'

env:
BUNDLE_WITHOUT: development:test:system_tests

jobs:
release:
name: Release
Expand Down
36 changes: 18 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
64 changes: 32 additions & 32 deletions .pmtignore
Original file line number Diff line number Diff line change
@@ -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
6 changes: 0 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@

inherit_gem:
voxpupuli-test: rubocop.yml

Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: consistent_comma

Style/WordArray:
EnforcedStyle: brackets
2 changes: 2 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
36 changes: 4 additions & 32 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
6 changes: 3 additions & 3 deletions examples/OK_ltgt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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, {}))
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/hash2array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/string2array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions manifests/hiera.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {})
)
}
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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",
Expand Down
41 changes: 41 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 0 additions & 21 deletions spec/acceptance/hieradata/common.yaml

This file was deleted.

Loading

0 comments on commit da14b31

Please sign in to comment.