Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace legacy facts #723

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -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']
42 changes: 42 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -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:
- "*"
17 changes: 17 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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: '9.0.0'
modulesync_config_version: '9.1.0'
3 changes: 3 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/php_fpm_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
end

describe 'when called with no parameters' do
case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
case facts[:operatingsystemrelease]
case facts[:os]['release']['major']
when '18.04'
it { is_expected.to contain_service('php7.2-fpm').with_ensure('running') }
when '22.04'
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/php_fpm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

describe 'when called with no parameters' do
# rubocop:disable RSpec/RepeatedExample
case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
case facts[:operatingsystemrelease]
case facts[:os]['release']['major']
when '18.04'
it { is_expected.to contain_package('php7.2-fpm').with_ensure('present') }
it { is_expected.to contain_service('php7.2-fpm').with_ensure('running') }
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/php_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
end

describe 'when configuring a package repo' do
case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
case facts[:operatingsystem]
case facts[:os]['name']
when 'Debian'
it { is_expected.to contain_class('php::repo::debian') }
when 'Ubuntu'
Expand Down
22 changes: 11 additions & 11 deletions spec/classes/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@
end

describe 'when called with no parameters' do
case facts[:osfamily]
case facts[:os]['family']
when 'Suse', 'RedHat', 'CentOS'
it { is_expected.to contain_class('php::global') }
end

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it { is_expected.not_to contain_class('php::global') }
it { is_expected.to contain_class('php::fpm') }
Expand Down Expand Up @@ -125,7 +125,7 @@

it { is_expected.to contain_php__extension('xml').with_ensure('absent') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it { is_expected.to contain_package(php_cli_package).with_ensure('absent') }
it { is_expected.to contain_package(php_fpm_package).with_ensure('absent') }
Expand All @@ -143,17 +143,17 @@
package_prefix = 'myphp-'
let(:params) { { package_prefix: package_prefix } }

case facts[:osfamily]
case facts[:os]['family']
when 'Suse', 'RedHat', 'CentOS'
it { is_expected.to contain_class('php::global') }
end

case facts[:osfamily]
case facts[:os]['family']
when 'Debian', 'RedHat', 'CentOS'
it { is_expected.to contain_package("#{package_prefix}cli").with_ensure('present') }
end

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it { is_expected.not_to contain_class('php::global') }
it { is_expected.to contain_class('php::fpm') }
Expand All @@ -179,7 +179,7 @@
it { is_expected.to contain_class('php::fpm').with(user: 'nginx') }
it { is_expected.to contain_php__fpm__pool('www').with(user: 'nginx') }

dstfile = case facts[:osfamily]
dstfile = case facts[:os]['family']
when 'Debian'
case facts[:os]['name']
when 'Debian'
Expand Down Expand Up @@ -224,7 +224,7 @@
it { is_expected.to contain_class('php::fpm').with(group: 'nginx') }
it { is_expected.to contain_php__fpm__pool('www').with(group: 'nginx') }

dstfile = case facts[:osfamily]
dstfile = case facts[:os]['family']
when 'Debian'
case facts[:os]['name']
when 'Debian'
Expand Down Expand Up @@ -276,7 +276,7 @@

it { is_expected.to contain_php__fpm__pool('www').with(apparmor_hat: 'www') }

dstfile = case facts[:osfamily]
dstfile = case facts[:os]['family']
when 'Debian'
case facts[:os]['name']
when 'Debian'
Expand Down Expand Up @@ -327,7 +327,7 @@
it { is_expected.not_to contain_class('php::composer') }
end

if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'CentOS' || facts[:os]['name'] == 'Ubuntu' || (facts[:os]['name'] == 'Debian' && facts[:os]['release']['major'].to_i < 12)
if facts[:os]['family'] == 'RedHat' || facts[:os]['family'] == 'CentOS' || facts[:os]['name'] == 'Ubuntu' || (facts[:os]['name'] == 'Debian' && facts[:os]['release']['major'].to_i < 12)
describe 'when called with flavor zend' do
zendphp_cli_package = case facts[:os]['name']
when 'Debian', 'Ubuntu'
Expand All @@ -349,13 +349,13 @@
}"
end

it { is_expected.to contain_class('zend_common::repo') }

Check failure on line 352 in spec/classes/php_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

php on ubuntu-18.04-x86_64 when called with flavor zend is expected to contain Class[zend_common::repo] Failure/Error: it { is_expected.to contain_class('zend_common::repo') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Function Call, ZendPHP does not support Ubuntu 18.04; see https://help.zend.com/zendphp/current/content/introduction/supported_platforms.htm for more information (file: /home/runner/work/puppet-php/puppet-php/spec/fixtures/modules/zend_common/manifests/repo.pp, line: 75, column: 9) on node fv-az711-531.kxtiaivj4gxuxgxjt4etq45iac.phxx.internal.cloudapp.net

Check failure on line 352 in spec/classes/php_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

php on ubuntu-18.04-x86_64 when called with flavor zend is expected to contain Class[zend_common::repo] Failure/Error: it { is_expected.to contain_class('zend_common::repo') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Function Call, ZendPHP does not support Ubuntu 18.04; see https://help.zend.com/zendphp/current/content/introduction/supported_platforms.htm for more information (file: /home/runner/work/puppet-php/puppet-php/spec/fixtures/modules/zend_common/manifests/repo.pp, line: 75, column: 9) on node fv-az1146-680.aaqb4uwu5meunphs5rk4w0rrmh.ex.internal.cloudapp.net
it { is_expected.to contain_package(zendphp_cli_package).with_ensure('present') }

Check failure on line 353 in spec/classes/php_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

php on ubuntu-18.04-x86_64 when called with flavor zend is expected to contain Package[php8.1-zend-cli] with ensure => "present" Failure/Error: it { is_expected.to contain_package(zendphp_cli_package).with_ensure('present') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Function Call, ZendPHP does not support Ubuntu 18.04; see https://help.zend.com/zendphp/current/content/introduction/supported_platforms.htm for more information (file: /home/runner/work/puppet-php/puppet-php/spec/fixtures/modules/zend_common/manifests/repo.pp, line: 75, column: 9) on node fv-az711-531.kxtiaivj4gxuxgxjt4etq45iac.phxx.internal.cloudapp.net

Check failure on line 353 in spec/classes/php_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

php on ubuntu-18.04-x86_64 when called with flavor zend is expected to contain Package[php8.1-zend-cli] with ensure => "present" Failure/Error: it { is_expected.to contain_package(zendphp_cli_package).with_ensure('present') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Function Call, ZendPHP does not support Ubuntu 18.04; see https://help.zend.com/zendphp/current/content/introduction/supported_platforms.htm for more information (file: /home/runner/work/puppet-php/puppet-php/spec/fixtures/modules/zend_common/manifests/repo.pp, line: 75, column: 9) on node fv-az1146-680.aaqb4uwu5meunphs5rk4w0rrmh.ex.internal.cloudapp.net
it { is_expected.to contain_package(zendphp_fpm_package).with_ensure('present') }

Check failure on line 354 in spec/classes/php_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

php on ubuntu-18.04-x86_64 when called with flavor zend is expected to contain Package[php8.1-zend-fpm] with ensure => "present" Failure/Error: it { is_expected.to contain_package(zendphp_fpm_package).with_ensure('present') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Function Call, ZendPHP does not support Ubuntu 18.04; see https://help.zend.com/zendphp/current/content/introduction/supported_platforms.htm for more information (file: /home/runner/work/puppet-php/puppet-php/spec/fixtures/modules/zend_common/manifests/repo.pp, line: 75, column: 9) on node fv-az711-531.kxtiaivj4gxuxgxjt4etq45iac.phxx.internal.cloudapp.net

Check failure on line 354 in spec/classes/php_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

php on ubuntu-18.04-x86_64 when called with flavor zend is expected to contain Package[php8.1-zend-fpm] with ensure => "present" Failure/Error: it { is_expected.to contain_package(zendphp_fpm_package).with_ensure('present') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Function Call, ZendPHP does not support Ubuntu 18.04; see https://help.zend.com/zendphp/current/content/introduction/supported_platforms.htm for more information (file: /home/runner/work/puppet-php/puppet-php/spec/fixtures/modules/zend_common/manifests/repo.pp, line: 75, column: 9) on node fv-az1146-680.aaqb4uwu5meunphs5rk4w0rrmh.ex.internal.cloudapp.net
end
end

if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'CentOS'
if facts[:os]['family'] == 'RedHat' || facts[:os]['family'] == 'CentOS'
describe 'when called with valid settings parameter types' do
let(:params) do
{
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/extension_rhscl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'php::extension' do
on_supported_os.each do |os, facts|
next unless facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'CentOS'
next unless facts[:os]['family'] == 'RedHat' || facts[:os]['family'] == 'CentOS'

context "on #{os}" do
let :facts do
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end
let(:pre_condition) { 'include php' }

unless facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD' # FIXME: something is wrong on these
unless facts[:os]['family'] == 'Suse' || facts[:os]['family'] == 'FreeBSD' # FIXME: something is wrong on these
etcdir = case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

require 'voxpupuli/test/spec_helper'

RSpec.configure do |c|
c.facterdb_string_keys = false
end

add_mocked_facts!

if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
Expand Down
Loading