diff --git a/manifests/apache/conf.pp b/manifests/apache/conf.pp index 81802f4e..df6975bb 100644 --- a/manifests/apache/conf.pp +++ b/manifests/apache/conf.pp @@ -39,6 +39,18 @@ package_name => 'libapache2-mod-wsgi-py3', mod_path => '/usr/lib/apache2/modules/mod_wsgi.so', }, + 'RedHat' => $facts['os']['release']['major'] ? { + '8' => { + package_name => $puppetboard::python_version ? { + '3.6' => 'python3-mod_wsgi', + '3.8' => 'python38-mod_wsgi', + '3.9' => 'python39-mod_wsgi', + default => fail('python version not supported'), + }, + mod_path => 'modules/mod_wsgi_python3.so', + }, + default => {}, + }, default => {}, } class { 'apache::mod::wsgi': diff --git a/manifests/apache/vhost.pp b/manifests/apache/vhost.pp index 30672b06..e8d54002 100644 --- a/manifests/apache/vhost.pp +++ b/manifests/apache/vhost.pp @@ -51,6 +51,18 @@ package_name => 'libapache2-mod-wsgi-py3', mod_path => '/usr/lib/apache2/modules/mod_wsgi.so', }, + 'RedHat' => $facts['os']['release']['major'] ? { + '8' => { + package_name => $puppetboard::python_version ? { + '3.6' => 'python3-mod_wsgi', + '3.8' => 'python38-mod_wsgi', + '3.9' => 'python39-mod_wsgi', + default => fail('python version not supported'), + }, + mod_path => 'modules/mod_wsgi_python3.so', + }, + default => {}, + }, default => {}, } class { 'apache::mod::wsgi': diff --git a/metadata.json b/metadata.json index 7956a1ca..24160001 100644 --- a/metadata.json +++ b/metadata.json @@ -33,6 +33,18 @@ "18.04", "20.04" ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "8" + ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "8" + ] } ], "requirements": [ @@ -44,7 +56,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 7.0.0 < 9.0.0" + "version_requirement": ">= 8.5.0 < 9.0.0" }, { "name": "puppet/python", diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 786a28ad..a91c9735 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -16,9 +16,15 @@ it 'works with no errors' do pp = <<-EOS # Configure PuppetDB + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { + $postgres_version = '13' + } else { + $postgres_version = undef + } class { 'puppetdb': - disable_ssl => true, - manage_firewall => false, + disable_ssl => true, + manage_firewall => false, + postgres_version => $postgres_version, } # Configure Puppetboard @@ -54,9 +60,15 @@ class { 'apache': } # Configure PuppetDB + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { + $postgres_version = '13' + } else { + $postgres_version = undef + } class { 'puppetdb': - disable_ssl => true, - manage_firewall => false, + disable_ssl => true, + manage_firewall => false, + postgres_version => $postgres_version, } # Configure Puppetboard @@ -103,9 +115,15 @@ class { 'puppetboard': require => Class['puppetdb'], } # Configure PuppetDB + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { + $postgres_version = '13' + } else { + $postgres_version = undef + } class { 'puppetdb': - disable_ssl => true, - manage_firewall => false, + disable_ssl => true, + manage_firewall => false, + postgres_version => $postgres_version, } EOS @@ -143,9 +161,15 @@ class { 'puppetboard::apache::conf': ldap_url => 'ldap://puppet.example.com', } # Configure PuppetDB + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { + $postgres_version = '13' + } else { + $postgres_version = undef + } class { 'puppetdb': - disable_ssl => true, - manage_firewall => false, + disable_ssl => true, + manage_firewall => false, + postgres_version => $postgres_version, } EOS @@ -191,9 +215,15 @@ class { 'puppetboard::apache::conf': ldap_require_group_dn => 'cn=admins,=cn=groups,dc=puppet,dc=example,dc=com', } # Configure PuppetDB + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { + $postgres_version = '13' + } else { + $postgres_version = undef + } class { 'puppetdb': - disable_ssl => true, - manage_firewall => false, + disable_ssl => true, + manage_firewall => false, + postgres_version => $postgres_version, } EOS diff --git a/spec/classes/apache/vhost_spec.rb b/spec/classes/apache/vhost_spec.rb index f2831896..4df06042 100644 --- a/spec/classes/apache/vhost_spec.rb +++ b/spec/classes/apache/vhost_spec.rb @@ -44,6 +44,42 @@ 'ensure' => 'file' ) end + + if ['RedHat'].include?(facts[:os]['family']) + ['3.6', '3.8', '3.9'].each do |python_version| + context "with python_versions #{python_version}" do + let(:pre_condition) do + [ + "class { 'puppetboard': python_version => \"#{python_version}\", }" + ] + end + + case python_version + when '3.6' + package_name = 'python3-mod_wsgi' + when '3.8' + package_name = 'python38-mod_wsgi' + when '3.9' + package_name = 'python39-mod_wsgi' + end + + it { is_expected.to contain_class('apache::mod::wsgi').with(package_name: package_name) } + end + end + + context 'with unsupported python_versions' do + let(:pre_condition) do + [ + "class { 'puppetboard': + python_version => '3.7', + } + " + ] + end + + it { is_expected.to raise_error(Puppet::Error, %r{python version not supported}) } + end + end end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 478b496e..f6f24865 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -4,7 +4,7 @@ configure_beaker do |host| # Install additional modules for soft deps - install_module_from_forge_on(host, 'puppetlabs-apache', '>= 2.1.0 < 7.0.0') - install_module_from_forge_on(host, 'puppetlabs-puppetdb', '>= 7.6.0 < 8.0.0') - install_module_from_forge_on(host, 'puppet-epel', '>= 3.0.0 < 5.0.0') + install_module_from_forge_on(host, 'puppetlabs-apache', '>= 8.2.1 < 9.0.0') + install_module_from_forge_on(host, 'puppetlabs-puppetdb', '>= 7.10.0 < 8.0.0') + install_module_from_forge_on(host, 'puppet-epel', '>= 4.1.0 < 5.0.0') end