Skip to content

(CAT-2360) Prepare module for Puppetcore #2600

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
9 changes: 8 additions & 1 deletion .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
--fail-on-warnings
--relative
--no-anchor_resource-check
--no-80chars-check
--no-140chars-check
--no-class_inherits_from_params_class-check
--no-autoloader_layout-check
--no-documentation-check
--no-single_quote_string_with_variables-check
--no-anchor_resource-check
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require:
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: '2.6'
TargetRubyVersion: '3.1'
Include:
- "**/*.rb"
Exclude:
Expand Down
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-11-28 08:35:58 UTC using RuboCop version 1.48.1.
# on 2025-07-08 13:54:59 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
Expand All @@ -23,7 +23,7 @@ RSpec/FilePath:
- 'spec/classes/mod/lookup_identity.rb'
- 'spec/classes/mod/proxy_wstunnel.rb'

# Offense count: 290
# Offense count: 306
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Expand Down
41 changes: 23 additions & 18 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,55 @@ def location_for(place_or_version, fake_version = nil)
end

group :development do
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "deep_merge", '~> 1.2.2', require: false
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
gem "facterdb", '~> 1.18', require: false
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "metadata-json-lint", '~> 4.0', require: false
gem "rspec-puppet-facts", '~> 2.0', require: false
gem "json-schema", '< 5.1.1', require: false
gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "dependency_checker", '~> 1.0.0', require: false
gem "parallel_tests", '= 3.12.1', require: false
gem "pry", '~> 0.10', require: false
gem "simplecov-console", '~> 0.9', require: false
gem "puppet-debugger", '~> 1.0', require: false
gem "puppet-debugger", '~> 1.6', require: false
gem "rubocop", '~> 1.50.0', require: false
gem "rubocop-performance", '= 1.16.0', require: false
gem "rubocop-rspec", '= 2.19.0', require: false
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "rexml", '>= 3.3.9', require: false
gem "bigdecimal", '< 3.2.2', require: false, platforms: [:mswin, :mingw, :x64_mingw]
end
group :development, :release_prep do
gem "puppet-strings", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 7.0', require: false
gem "puppetlabs_spec_helper", '~> 8.0', require: false
gem "puppet-blacksmith", '~> 7.0', require: false
end
group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] if ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "serverspec", '~> 2.41', require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
facter_version = ENV['FACTER_GEM_VERSION']
hiera_version = ENV['HIERA_GEM_VERSION']

gems = {}
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)

gems['puppet'] = location_for(puppet_version)

# If facter or hiera versions have been specified via the environment
# variables
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
# Otherwise, do as before and use location_for to fetch gems from the default source
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
else
gems['puppet'] = location_for(puppet_version)
gems['facter'] = location_for(facter_version) if facter_version
end

gems['facter'] = location_for(facter_version) if facter_version
gems['hiera'] = location_for(hiera_version) if hiera_version

gems.each do |gem_name, gem_params|
Expand Down
9 changes: 9 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'

PuppetLint.configuration.send('disable_relative')
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_autoloader_layout')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
PuppetLint.configuration.send('disable_anchor_resource')
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"]

6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 7.9.0 < 9.0.0"
"version_requirement": ">= 8.0.0 < 9.0.0"
}
],
"description": "Module for Apache configuration",
"pdk-version": "3.2.0",
"pdk-version": "3.5.0 (ga43db72)",
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
"template-ref": "tags/3.2.0.4-0-g5d17ec1"
"template-ref": "heads/main-0-ga1e4056"
}
13 changes: 3 additions & 10 deletions spec/classes/mod/alias_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /icons/ "/usr/share/apache2/icons/"}) }
end

context 'on a RedHat 7-based OS', :compile do
include_examples 'RedHat 7'

it { is_expected.to contain_apache__mod('alias') }
it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /icons/ "/usr/share/httpd/icons/"}) }
end

context 'on a RedHat 8-based OS', :compile do
include_examples 'RedHat 8'

Expand All @@ -37,7 +30,7 @@
}
end

include_examples 'RedHat 7'
include_examples 'RedHat 8'

it { is_expected.to contain_apache__mod('alias') }
it { is_expected.to contain_file('alias.conf').with(content: %r{Options foo}) }
Expand All @@ -53,7 +46,7 @@
}
end

include_examples 'RedHat 7'
include_examples 'RedHat 8'

it { is_expected.to contain_apache__mod('alias') }
it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /apache-icons/ "/usr/share/httpd/icons/"}) }
Expand All @@ -69,7 +62,7 @@
}
end

include_examples 'RedHat 7'
include_examples 'RedHat 8'

it { is_expected.to contain_apache__mod('alias') }
it { is_expected.not_to contain_file('alias.conf') }
Expand Down
9 changes: 0 additions & 9 deletions spec/classes/mod/auth_kerb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
it_behaves_like 'a mod class, without including apache'

context 'default configuration with parameters' do
context 'on a Debian OS', :compile do
include_examples 'Debian 10'

it { is_expected.to contain_class('apache::params') }
it { is_expected.to contain_class('apache::mod::authn_core') }
it { is_expected.to contain_apache__mod('auth_kerb') }
it { is_expected.to contain_package('libapache2-mod-auth-kerb') }
end

context 'on a RedHat OS', :compile do
include_examples 'RedHat 8'

Expand Down
10 changes: 0 additions & 10 deletions spec/classes/mod/auth_openidc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
it { is_expected.not_to contain_package('dnf-module-mod_auth_openidc') }
end

context 'on RedHat 7', :compile do
include_examples 'RedHat 7'

it { is_expected.to contain_class('apache::mod::authn_core') }
it { is_expected.to contain_class('apache::mod::authz_user') }
it { is_expected.to contain_apache__mod('auth_openidc') }
it { is_expected.to contain_package('mod_auth_openidc') }
it { is_expected.not_to contain_package('dnf-module-mod_auth_openidc') }
end

context 'on RedHat 8', :compile do
include_examples 'RedHat 8'

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/mod/authnz_ldap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

it { is_expected.to contain_class('apache::params') }
it { is_expected.to contain_class('apache::mod::ldap') }
it { is_expected.to contain_apache__mod('authnz_ldap') }
it { is_expected.to contain_file('authnz_ldap.conf') }

context 'default verify_server_cert' do
it { is_expected.to contain_file('authnz_ldap.conf').with_content(%r{^LDAPVerifyServerCert On$}) }
Expand All @@ -34,6 +34,7 @@
context 'default configuration with parameters on a RedHat OS' do
on_supported_os.each do |os, os_facts|
next unless os.start_with?('redhat')
next if os.start_with?('redhat')

context "On #{os}" do
let :facts do
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/mod/cluster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require 'spec_helper'

describe 'apache::mod::cluster', type: :class do
context 'on a RedHat OS Release 7 with mod version = 1.3.0' do
include_examples 'RedHat 7'
context 'on a RedHat OS Release 8 with mod version = 1.3.0' do
include_examples 'RedHat 8'

let(:params) do
{
Expand All @@ -26,8 +26,8 @@
it { is_expected.to contain_file('cluster.conf') }
end

context 'on a RedHat OS Release 7 with mod version > 1.3.0' do
include_examples 'RedHat 7'
context 'on a RedHat OS Release 8 with mod version > 1.3.0' do
include_examples 'RedHat 8'

let(:params) do
{
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/mod/expires_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
end

include_examples 'RedHat 7'
include_examples 'RedHat 8'

it { is_expected.to contain_apache__mod('expires') }

Expand All @@ -47,7 +47,7 @@
}
end

include_examples 'RedHat 7'
include_examples 'RedHat 8'

it { is_expected.to contain_apache__mod('expires') }

Expand Down
4 changes: 2 additions & 2 deletions spec/classes/mod/fcgid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
it { is_expected.to contain_package('libapache2-mod-fcgid') }
end

context 'on RHEL7' do
include_examples 'RedHat 7'
context 'on RHEL8' do
include_examples 'RedHat 8'

describe 'without parameters' do
it { is_expected.to contain_class('apache::params') }
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/mod/proxy_html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
context 'on a Debian OS' do
shared_examples 'debian' do |loadfiles|
it { is_expected.to contain_class('apache::params') }
it { is_expected.to contain_apache__mod('proxy_html').with(loadfiles: loadfiles) }
it { is_expected.to contain_apache__mod('proxy_html').with(loadfiles:) }
end

include_examples 'Debian 11'
Expand Down
16 changes: 0 additions & 16 deletions spec/classes/mod/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,6 @@
it { is_expected.to contain_file('ssl.conf').without_content(%r{ SSLCipherSuite TLSv1.2 RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW}) }
end
end

context '7 OS with custom directories for PR#1635' do
include_examples 'RedHat 7'
let :pre_condition do
"class { 'apache':
confd_dir => '/etc/httpd/conf.puppet.d',
default_mods => false,
default_vhost => false,
mod_dir => '/etc/httpd/conf.modules.puppet.d',
vhost_dir => '/etc/httpd/conf.puppet.d',
}"
end

it { is_expected.to contain_package('mod_ssl') }
it { is_expected.to contain_file('ssl.conf').with_path('/etc/httpd/conf.puppet.d/ssl.conf') }
end
end

context 'on a Debian OS' do
Expand Down
10 changes: 0 additions & 10 deletions spec/classes/mod/status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,6 @@ def require_directives(requires)
}
end

context 'on a RedHat 7 OS' do
include_examples 'RedHat 7'

it { is_expected.to contain_apache__mod('status') }

include_examples 'status_conf_spec_require', req_value, 'On', '/server-status'

it { is_expected.to contain_file('status.conf').with_path('/etc/httpd/conf.modules.d/status.conf') }
end

context 'on a RedHat 8 OS' do
include_examples 'RedHat 8'

Expand Down
2 changes: 1 addition & 1 deletion spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@
end

describe 'serveraliases parameter' do
let(:params) { default_params.merge(serveraliases: serveraliases) }
let(:params) { default_params.merge(serveraliases:) }

context 'with a string' do
let(:serveraliases) { 'alias.example.com' }
Expand Down
10 changes: 1 addition & 9 deletions spec/spec_helper_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@
end

shared_context 'a mod class, without including apache' do
let(:facts) { on_supported_os['debian-10-x86_64'] }
end

shared_context 'Debian 10' do
let(:facts) { on_supported_os['debian-10-x86_64'] }
let(:facts) { on_supported_os['debian-11-x86_64'] }
end

shared_context 'Debian 11' do
Expand All @@ -49,10 +45,6 @@
let(:facts) { on_supported_os['ubuntu-18.04-x86_64'] }
end

shared_context 'RedHat 7' do
let(:facts) { on_supported_os['redhat-7-x86_64'] }
end

shared_context 'RedHat 8' do
let(:facts) { on_supported_os['redhat-8-x86_64'] }
end
Expand Down
Loading