diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 88093274..daceb642 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 7899de84..f2d08d6b 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 00000000..f5b5d7a9 --- /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 00000000..66127cd0 --- /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 55324aa6..93b33c2b 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 36071685..95e8c977 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 02a3e71d..37817b67 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --fail-on-warnings diff --git a/.sync.yml b/.sync.yml index 130aaeb3..4d983e98 100644 --- a/.sync.yml +++ b/.sync.yml @@ -3,3 +3,5 @@ enabled_lint_checks: - parameter_documentation - parameter_types +spec/spec_helper.rb: + facterdb_string_keys: true diff --git a/Gemfile b/Gemfile index 27cdc0de..7123c663 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/letsencrypt_spec.rb b/spec/classes/letsencrypt_spec.rb index b26fee8a..20a9ba80 100644 --- a/spec/classes/letsencrypt_spec.rb +++ b/spec/classes/letsencrypt_spec.rb @@ -17,8 +17,7 @@ describe 'with defaults' do it { is_expected.to compile } - epel = facts[:osfamily] == 'RedHat' && facts[:operatingsystem] != 'Fedora' - + epel = facts['os']['family'] == 'RedHat' && facts['os']['name'] != 'Fedora' it 'contains the correct resources' do is_expected.to contain_class('letsencrypt::install'). with(configure_epel: epel). @@ -33,7 +32,7 @@ cron_monthday: ['*']) is_expected.to contain_cron('letsencrypt-renew').with_ensure('absent') - if facts[:osfamily] == 'FreeBSD' + if facts['os']['family'] == 'FreeBSD' is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email foo@example.com') is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini server https://acme-v02.api.letsencrypt.org/directory') is_expected.to contain_file('letsencrypt-renewal-hooks-puppet'). @@ -50,7 +49,7 @@ is_expected.to contain_file('letsencrypt-renewal-hooks-puppet').with_path('/etc/letsencrypt/renewal-hooks-puppet') end - if facts[:osfamily] == 'RedHat' + if facts['os']['family'] == 'RedHat' if epel is_expected.to contain_class('epel').that_comes_before('Package[letsencrypt]') else @@ -60,20 +59,20 @@ is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') is_expected.to contain_package('letsencrypt').with(name: 'certbot').with_ensure('installed') is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') - elsif facts[:osfamily] == 'Debian' + elsif facts['os']['family'] == 'Debian' is_expected.to contain_class('letsencrypt::install').with(package_name: 'certbot') is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') - elsif facts[:operatingsystem] == 'Gentoo' + elsif facts['os']['name'] == 'Gentoo' is_expected.to contain_class('letsencrypt::install').with(package_name: 'app-crypt/certbot') is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') is_expected.to contain_package('letsencrypt').with(name: 'app-crypt/certbot').with_ensure('installed') is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') - elsif facts[:operatingsystem] == 'OpenBSD' + elsif facts['os']['name'] == 'OpenBSD' is_expected.to contain_class('letsencrypt::install').with(package_name: 'certbot') is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') is_expected.to contain_package('letsencrypt').with(name: 'certbot').with_ensure('installed') is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') - elsif facts[:operatingsystem] == 'FreeBSD' + elsif facts['os']['name'] == 'FreeBSD' is_expected.to contain_class('letsencrypt::install').with(package_name: 'py311-certbot') is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') is_expected.to contain_package('letsencrypt').with(name: 'py311-certbot').with_ensure('installed') @@ -100,7 +99,7 @@ describe 'with custom config' do let(:additional_params) { { config: { 'foo' => 'bar' } } } - case facts[:operatingsystem] + case facts['os']['name'] when 'FreeBSD' it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini foo bar') } else @@ -237,7 +236,7 @@ it { is_expected.to compile.with_all_deps } - case facts[:operatingsystem] + case facts['os']['name'] when 'FreeBSD' it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email foo@example.com') } else @@ -253,7 +252,7 @@ context 'with unsafe_registration set to true' do let(:params) { { unsafe_registration: true } } - case facts[:operatingsystem] + case facts['os']['name'] when 'FreeBSD' it { is_expected.not_to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email foo@example.com') } it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini register-unsafely-without-email true') } diff --git a/spec/classes/plugin/dns_cloudflare_spec.rb b/spec/classes/plugin/dns_cloudflare_spec.rb index 29e87f05..57e961ef 100644 --- a/spec/classes/plugin/dns_cloudflare_spec.rb +++ b/spec/classes/plugin/dns_cloudflare_spec.rb @@ -15,9 +15,9 @@ class { 'letsencrypt': PUPPET end let(:package_name) do - if %w[Debian RedHat].include?(facts[:os]['family']) + if %w[Debian RedHat].include?(facts['os']['family']) 'python3-certbot-dns-cloudflare' - elsif %w[FreeBSD].include?(facts[:os]['family']) + elsif %w[FreeBSD].include?(facts['os']['family']) 'py311-certbot-dns-cloudflare' end end diff --git a/spec/classes/plugin/dns_rfc2136_spec.rb b/spec/classes/plugin/dns_rfc2136_spec.rb index 8e7ab96a..0d3d6a4a 100644 --- a/spec/classes/plugin/dns_rfc2136_spec.rb +++ b/spec/classes/plugin/dns_rfc2136_spec.rb @@ -15,7 +15,7 @@ class { 'letsencrypt': PUPPET end let(:package_name) do - case facts[:os]['family'] + case facts['os']['family'] when 'FreeBSD' 'py311-certbot-dns-rfc2136' when 'OpenBSD' @@ -39,7 +39,7 @@ class { 'letsencrypt': end # FreeBSD uses a different filesystem path - let(:pathprefix) { facts[:kernel] == 'FreeBSD' ? '/usr/local' : '' } + let(:pathprefix) { facts['kernel'] == 'FreeBSD' ? '/usr/local' : '' } it do if package_name.empty? diff --git a/spec/classes/plugin/dns_route53_spec.rb b/spec/classes/plugin/dns_route53_spec.rb index ab218dc9..7399fb5d 100644 --- a/spec/classes/plugin/dns_route53_spec.rb +++ b/spec/classes/plugin/dns_route53_spec.rb @@ -15,7 +15,7 @@ class { 'letsencrypt': PUPPET end let(:package_name) do - case facts[:os]['family'] + case facts['os']['family'] when 'FreeBSD' 'py311-certbot-dns-route53' when 'OpenBSD' diff --git a/spec/defines/letsencrypt_certonly_spec.rb b/spec/defines/letsencrypt_certonly_spec.rb index 26c5ee77..6ded37de 100644 --- a/spec/defines/letsencrypt_certonly_spec.rb +++ b/spec/defines/letsencrypt_certonly_spec.rb @@ -12,7 +12,7 @@ let(:pre_condition) { "class { letsencrypt: email => 'foo@example.com', package_command => 'letsencrypt' }" } # FreeBSD uses a different filesystem path - pathprefix = facts[:kernel] == 'FreeBSD' ? '/usr/local' : '' + pathprefix = facts['kernel'] == 'FreeBSD' ? '/usr/local' : '' context 'with a single domain' do let(:title) { 'foo.example.com' } @@ -32,7 +32,7 @@ with_content(%r{#!/bin/sh}) end - if facts[:osfamily] == 'FreeBSD' + if facts['os']['family'] == 'FreeBSD' it { is_expected.to contain_file('/usr/local/etc/letsencrypt') } it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email foo@example.com') } it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini server https://acme-v02.api.letsencrypt.org/directory') } @@ -497,7 +497,7 @@ class { 'letsencrypt::plugin::dns_cloudflare': it { is_expected.to contain_exec('letsencrypt certonly foo.example.com').with_unless(['test ! -f /usr/local/sbin/letsencrypt-domain-validation', '/usr/local/sbin/letsencrypt-domain-validation /foo/bar/baz/live/foo.example.com/cert.pem \'foo.example.com\'']) } end - context 'on FreeBSD', if: facts[:os]['name'] == 'FreeBSD' do + context 'on FreeBSD', if: facts['os']['name'] == 'FreeBSD' do let(:title) { 'foo.example.com' } let(:pre_condition) { "class { letsencrypt: email => 'foo@example.com'}" } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9efb4ae6..d9a3f293 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'))