diff --git a/.fixtures.yml b/.fixtures.yml index 8bcecca57..9af298411 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,7 +2,9 @@ fixtures: repositories: apache: https://github.com/puppetlabs/puppetlabs-apache.git apt: https://github.com/puppetlabs/puppetlabs-apt.git - firewall: https://github.com/puppetlabs/puppetlabs-firewall + firewall: + repo: https://github.com/puppetlabs/puppetlabs-firewall + ref: v6.0.0 stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git concat: https://github.com/puppetlabs/puppetlabs-concat.git postgresql: https://github.com/puppetlabs/puppet-postgresql.git diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cfb9..6aaa603ff 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.gitignore b/.gitignore index 9b95224ce..84fd904ca 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 f3156d15e..dd3e95722 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.4.0' +modulesync_config_version: '7.0.0' diff --git a/.pmtignore b/.pmtignore index 65f505149..58a040887 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_todo.yml b/.rubocop_todo.yml index a28f73a01..de61065fa 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-03-09 21:00:49 UTC using RuboCop version 1.22.3. +# on 2023-08-17 21:27:12 UTC using RuboCop version 1.50.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -19,26 +19,29 @@ Lint/MissingSuper: Exclude: - 'spec/serverspec_type_zabbixapi.rb' -# Offense count: 7 +# Offense count: 1 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to Naming/MethodParameterName: Exclude: - 'lib/puppet/provider/zabbix_proxy/ruby.rb' - - 'lib/puppet/type/zabbix_host.rb' - - 'lib/puppet/type/zabbix_template.rb' -# Offense count: 4 +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/acceptance/zabbix_proxy_spec.rb' + - 'spec/unit/puppet/type/zabbix_template_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). RSpec/EmptyExampleGroup: Exclude: - 'spec/classes/agent_spec.rb' - - 'spec/classes/javagateway_spec.rb' - - 'spec/classes/server_spec.rb' -# Offense count: 4 +# Offense count: 2 RSpec/RepeatedExampleGroupDescription: Exclude: - - 'spec/classes/database_mysql_spec.rb' - 'spec/defines/startup_spec.rb' # Offense count: 1 diff --git a/Gemfile b/Gemfile index 557f2c49e..fc243de77 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 2.0', :require => false + gem 'puppet_metadata', '~> 3.0', :require => false gem 'fakefs', :require => false gem 'zabbixapi', :require => false end @@ -18,19 +18,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 c64131ae4..90c180a1a 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 = 'voxpupuli' + GCGConfig.project = 'puppet-zabbix' 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 = 'voxpupuli' - config.project = 'puppet-zabbix' - 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/manifests/repo.pp b/manifests/repo.pp index 7890343c6..384a6c1a4 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -87,7 +87,7 @@ } } - if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) { + if ($facts['os']['name'] == 'CentOS' and $facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) { package { 'zabbix-required-scl-repo': ensure => 'latest', name => 'centos-release-scl', diff --git a/metadata.json b/metadata.json index bdcee59e3..c6f5ed8ec 100644 --- a/metadata.json +++ b/metadata.json @@ -22,7 +22,7 @@ }, { "name": "puppetlabs/firewall", - "version_requirement": ">= 1.7.0 < 4.0.0" + "version_requirement": ">= 1.7.0 < 7.0.0" }, { "name": "puppetlabs/apt", diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index f3ad90c65..c67fa975c 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -110,7 +110,7 @@ it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl('https://repo.zabbix.com/non-supported/rhel/7/$basearch/') } it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4') } - it { is_expected.to contain_package('zabbix-required-scl-repo').with_ensure('latest').with_name('centos-release-scl') } + it { is_expected.to contain_package('zabbix-required-scl-repo').with_ensure('latest').with_name('centos-release-scl') } if facts[:os]['name'] == 'CentOS' end when '9' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a68e7dbe8..0aec83fe7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,3 +25,4 @@ require 'support/acceptance/supported_versions' require 'spec_helper_methods' +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } diff --git a/spec/unit/puppet/type/zabbix_template_spec.rb b/spec/unit/puppet/type/zabbix_template_spec.rb index 085a83271..9f650dcb5 100644 --- a/spec/unit/puppet/type/zabbix_template_spec.rb +++ b/spec/unit/puppet/type/zabbix_template_spec.rb @@ -116,9 +116,7 @@ content EOS FileUtils.mkdir_p '/path/to' - File.open(mock_template_source_file, 'w') do |f| - f.write mock_file_content - end + File.write(mock_template_source_file, mock_file_content) expect(property.source_xml).to eq mock_file_content end end