diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8809327..daceb64 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -245,15 +245,23 @@ with: BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` +or + +```sh +BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker +``` + +This latter example will use the distribution's own version of Puppet. + You can replace the string `debian11` with any common operating system. The following strings are known to work: * ubuntu2004 * ubuntu2204 * debian11 -* centos7 -* centos8 +* debian12 * centos9 +* archlinux * almalinux8 * almalinux9 * fedora36 diff --git a/.github/labeler.yml b/.github/labeler.yml index 7899de8..f2d08d6 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,6 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + skip-changelog: - head-branch: ['^release-*', 'release'] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..f5b5d7a --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,42 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + +changelog: + exclude: + labels: + - duplicate + - invalid + - modulesync + - question + - skip-changelog + - wont-fix + - wontfix + + categories: + - title: Breaking Changes 🛠 + labels: + - backwards-incompatible + + - title: New Features 🎉 + labels: + - enhancement + + - title: Bug Fixes 🐛 + labels: + - bug + + - title: Documentation Updates 📚 + labels: + - documentation + - docs + + - title: Dependency Updates ⬆️ + labels: + - dependencies + + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..66127cd --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,17 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: "Pull Request Labeler" + +on: + pull_request_target: {} + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55324aa..93b33c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,3 +20,10 @@ jobs: # https://docs.github.com/en/actions/security-guides/encrypted-secrets username: ${{ secrets.PUPPET_FORGE_USERNAME }} api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} + + create-github-release: + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - name: Create GitHub release + uses: voxpupuli/gha-create-a-github-release@v1 diff --git a/.msync.yml b/.msync.yml index 3607168..95e8c97 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: '9.0.0' +modulesync_config_version: '9.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc index dd8272c..05d28a2 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --fail-on-warnings --no-parameter_documentation-check --no-parameter_types-check diff --git a/.sync.yml b/.sync.yml index 5d21319..a3a2734 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,3 +1,5 @@ --- spec/spec_helper_acceptance.rb: unmanaged: false +spec/spec_helper.rb: + facterdb_string_keys: true diff --git a/Gemfile b/Gemfile index 27cdc0d..7123c66 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 8.0', :require => false + gem 'voxpupuli-test', '~> 9.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 4.0', :require => false diff --git a/spec/classes/defaults_spec.rb b/spec/classes/defaults_spec.rb index 542c60d..a5eb19b 100644 --- a/spec/classes/defaults_spec.rb +++ b/spec/classes/defaults_spec.rb @@ -6,20 +6,20 @@ let(:pre_condition) { 'class { "logrotate": }' } context 'no osfamily' do - let(:facts) { { os: { family: 'fake' } } } + let(:facts) { { 'os' => { 'family' => 'fake' } } } it { is_expected.to contain_logrotate__conf('/etc/logrotate.conf') } end - on_supported_os.each do |os, facts| - context os, if: facts[:osfamily] == 'Debian' do - let(:facts) { facts } + on_supported_os.each do |os, os_facts| + context os, if: os_facts['os']['family'] == 'Debian' do + let(:facts) { os_facts } it { is_expected.to compile.with_all_deps } - if facts[:operatingsystem] == 'Ubuntu' + if os_facts['os']['name'] == 'Ubuntu' it { is_expected.to contain_logrotate__conf('/etc/logrotate.conf').with( 'su_user' => 'root', @@ -56,8 +56,8 @@ } end - context os, if: facts[:osfamily] == 'RedHat' do - let(:facts) { facts } + context os, if: os_facts['os']['family'] == 'RedHat' do + let(:facts) { os_facts } it { is_expected.to contain_logrotate__conf('/etc/logrotate.conf') @@ -67,7 +67,7 @@ is_expected.to contain_logrotate__rule('wtmp').with( 'path' => '/var/log/wtmp', 'create_mode' => '0664', - 'missingok' => facts[:operatingsystemmajrelease].to_i >= 8, + 'missingok' => facts['os']['release']['major'].to_i >= 8, 'minsize' => '1M', 'create' => true, 'create_owner' => 'root', @@ -91,7 +91,7 @@ } end - context os, if: facts[:osfamily] == 'Suse' do + context os, if: os_facts['os']['family'] == 'Suse' do it { is_expected.to contain_logrotate__conf('/etc/logrotate.conf') } @@ -113,8 +113,8 @@ } end - context os, if: facts[:osfamily] == 'FreeBSD' do - let(:facts) { facts } + context os, if: os_facts['os']['family'] == 'FreeBSD' do + let(:facts) { os_facts } it { is_expected.to contain_logrotate__conf('/usr/local/etc/logrotate.conf') diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 28475bc..2b649be 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -4,10 +4,10 @@ describe 'logrotate' do context 'supported operating systems' do - on_supported_os.each do |os, facts| + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) do - facts + os_facts end context 'logrotate class without any parameters' do @@ -18,7 +18,7 @@ it { is_expected.to contain_class("logrotate::#{classs}") } end - case facts[:operatingsystem] + case os_facts['os']['name'] when 'FreeBSD' it do is_expected.to contain_file('/usr/local/etc/logrotate.d/hourly').with( @@ -52,7 +52,7 @@ is_expected.to contain_class('logrotate::defaults') end - if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i >= 9 + if os_facts['os']['family'] == 'RedHat' && os_facts['os']['release']['major'].to_i >= 9 it do is_expected.to contain_service('logrotate.timer').with( 'ensure' => 'running', @@ -142,7 +142,7 @@ context 'logrotate class with purge_configdir set to true' do let(:params) { { purge_configdir: true } } - case facts[:operatingsystem] + case os_facts['os']['name'] when 'FreeBSD' it do is_expected.to contain_file('/usr/local/etc/logrotate.d').with('ensure' => 'directory', @@ -176,7 +176,7 @@ context 'with config => { prerotate => "/usr/bin/test", rotate_every => "daily" }' do let(:params) { { config: { prerotate: '/usr/bin/test', rotate_every: 'daily' } } } - case facts[:operatingsystem] + case os_facts['os']['name'] when 'FreeBSD' it { is_expected.to contain_logrotate__conf('/usr/local/etc/logrotate.conf'). @@ -195,7 +195,7 @@ context 'with ensure => absent' do let(:params) { { ensure_cron_hourly: 'absent' } } - case facts[:operatingsystem] + case os_facts['os']['name'] when 'FreeBSD' it { is_expected.to contain_file('/usr/local/etc/logrotate.d/hourly').with_ensure('directory') } else diff --git a/spec/defines/cron_spec.rb b/spec/defines/cron_spec.rb index 9e56587..4b6fbd9 100644 --- a/spec/defines/cron_spec.rb +++ b/spec/defines/cron_spec.rb @@ -6,17 +6,17 @@ context 'supported operating systems' do let(:pre_condition) { 'class { "logrotate": }' } - on_supported_os.each do |os, facts| + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) do - facts + os_facts end context 'With default params' do let(:title) { 'test' } let(:params) { { ensure: 'present' } } - if facts[:osfamily] == 'FreeBSD' + if os_facts['os']['family'] == 'FreeBSD' it { is_expected.to contain_file('/usr/local/bin/logrotate.test.sh'). with_ensure('present'). @@ -36,7 +36,7 @@ let(:title) { 'test' } let(:params) { { ensure: 'present' } } - if facts[:osfamily] == 'FreeBSD' + if os_facts['os']['family'] == 'FreeBSD' it { is_expected.to contain_file('/usr/local/bin/logrotate.test.sh'). with_ensure('present'). @@ -56,7 +56,7 @@ # Test FreeBSD separately as it is only partially supported by the module and not in the list of supported os. # When FreeBSD is added to the list of supported systems, these tests can be removed as they are already part of the test set above. context 'on FreeBDS' do - let(:facts) { { os: { family: 'FreeBSD' } } } + let(:facts) { { 'os' => { 'family' => 'FreeBSD' } } } context 'With default params' do let(:title) { 'test' } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9efb4ae..d9a3f29 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,10 @@ require 'voxpupuli/test/spec_helper' +RSpec.configure do |c| + c.facterdb_string_keys = true +end + add_mocked_facts! if File.exist?(File.join(__dir__, 'default_module_facts.yml'))