From 49d88060c8ccfc641e180be291560037a45a8dc2 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 18 Dec 2024 15:30:23 +0100 Subject: [PATCH] Drop EoL EL8 / Ubuntu 20.04 / Debian 11 support Foreman 3.13.0 doesn't provide packages for those platforms anymore. --- manifests/config/apache.pp | 22 +---------- manifests/plugin/remote_execution/cockpit.pp | 9 +---- manifests/repo.pp | 9 ----- metadata.json | 5 --- spec/acceptance/foreman_cli_plugins_spec.rb | 10 ----- spec/classes/foreman_config_apache_spec.rb | 37 +------------------ spec/classes/foreman_repo_spec.rb | 8 ---- spec/classes/foreman_service_spec.rb | 2 +- .../plugin/remote_execution_cockpit_spec.rb | 14 +------ spec/defines/foreman_rake_spec.rb | 2 +- spec/defines/foreman_repos_apt_spec.rb | 16 ++++---- spec/support/plugin.rb | 2 +- templates/cockpit-apache-ssl-rewrite.conf.erb | 11 ------ 13 files changed, 17 insertions(+), 130 deletions(-) delete mode 100644 templates/cockpit-apache-ssl-rewrite.conf.erb diff --git a/manifests/config/apache.pp b/manifests/config/apache.pp index 43ca86c7d..e30a65e03 100644 --- a/manifests/config/apache.pp +++ b/manifests/config/apache.pp @@ -183,24 +183,6 @@ order => '03', } - # mod_proxy supports "ProxyPass ... upgrade=websocket" since 2.4.47 - # EL8: 2.4.37 / EL9: 2.4.62 / Debian11: 2.4.62 / Ubuntu20.04: 2.4.41 / Ubuntu22.04: 2.4.52 - $proxy_upgrade_websocket = !($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') and !($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') - if $proxy_upgrade_websocket { - $vhost_rewrites = [] - $_proxy_params = $proxy_params + { 'upgrade' => 'websocket' } - } else { - include apache::mod::proxy_wstunnel - $websockets_backend = regsubst($_proxy_backend, 'http://', 'ws://') - $websockets_rewrite = { - 'comment' => 'Upgrade Websocket connections', - 'rewrite_cond' => '%{HTTP:Upgrade} =websocket [NC]', - 'rewrite_rule' => "/(.*) ${websockets_backend}\$1 [P,L]", - } - $vhost_rewrites = [$websockets_rewrite] - $_proxy_params = $proxy_params - } - $vhost_http_request_headers = [ 'set X_FORWARDED_PROTO "http"', 'set SSL_CLIENT_S_DN ""', @@ -225,9 +207,9 @@ 'no_proxy_uris' => $_proxy_no_proxy_uris, 'path' => pick($suburi, '/'), 'url' => $_proxy_backend, - 'params' => $_proxy_params, + 'params' => $proxy_params + { 'upgrade' => 'websocket' }, }, - 'rewrites' => $vhost_rewrites, + 'rewrites' => [], } $vhost_https_request_headers = [ diff --git a/manifests/plugin/remote_execution/cockpit.pp b/manifests/plugin/remote_execution/cockpit.pp index 4bbb4c46f..8fb5807c4 100644 --- a/manifests/plugin/remote_execution/cockpit.pp +++ b/manifests/plugin/remote_execution/cockpit.pp @@ -75,15 +75,8 @@ } } else { include apache::mod::proxy_http - if $foreman::config::apache::proxy_upgrade_websocket { - $_apache_template = 'cockpit-apache-ssl.conf.erb' - } else { - include apache::mod::rewrite - include apache::mod::proxy_wstunnel - $_apache_template = 'cockpit-apache-ssl-rewrite.conf.erb' - } foreman::config::apache::fragment { 'cockpit': - ssl_content => template("foreman/${_apache_template}"), + ssl_content => template('foreman/cockpit-apache-ssl.conf.erb'), } foreman_config_entry { 'remote_execution_cockpit_url': diff --git a/manifests/repo.pp b/manifests/repo.pp index 34bf06d81..2799731e1 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -20,15 +20,6 @@ yum_repo_baseurl => $yum_repo_baseurl, before => Anchor['foreman::repo'], } - - if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { - package { 'foreman': - ensure => "el${facts['os']['release']['major']}", - enable_only => true, - provider => 'dnfmodule', - require => Foreman::Repos['foreman'], - } - } } # An anchor is used because it can be collected diff --git a/metadata.json b/metadata.json index c6948b0bd..27288cfed 100644 --- a/metadata.json +++ b/metadata.json @@ -55,35 +55,30 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "8", "9" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "8", "9" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ - "11", "12" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "20.04", "22.04" ] }, { "operatingsystem": "AlmaLinux", "operatingsystemrelease": [ - "8", "9" ] } diff --git a/spec/acceptance/foreman_cli_plugins_spec.rb b/spec/acceptance/foreman_cli_plugins_spec.rb index 51ef1fcae..2d150fc90 100644 --- a/spec/acceptance/foreman_cli_plugins_spec.rb +++ b/spec/acceptance/foreman_cli_plugins_spec.rb @@ -68,16 +68,6 @@ class { 'foreman::cli': gpgcheck => 0, } - if $facts['os']['release']['major'] == '8' { - package { 'katello': - ensure => "el${facts['os']['release']['major']}", - enable_only => true, - provider => 'dnfmodule', - require => Yumrepo['katello'], - } - Package['katello'] -> Class['foreman::cli::katello'] - } - class { 'foreman::cli': foreman_url => 'https://foreman.example.com', username => 'admin', diff --git a/spec/classes/foreman_config_apache_spec.rb b/spec/classes/foreman_config_apache_spec.rb index 4f9bb8144..88a5a5824 100644 --- a/spec/classes/foreman_config_apache_spec.rb +++ b/spec/classes/foreman_config_apache_spec.rb @@ -16,12 +16,7 @@ end let(:proxy_pass_params) do - if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '8') || - (facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04') - { 'retry' => '0' } - else - { 'retry' => '0', 'upgrade' => 'websocket' } - end + { 'retry' => '0', 'upgrade' => 'websocket' } end @@ -33,10 +28,6 @@ should contain_class('apache::mod::proxy') should contain_class('apache::mod::proxy_http') should contain_class('apache::mod::rewrite') - if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '8') || - (facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04') - should contain_class('apache::mod::proxy_wstunnel') - end end it 'does not manage the docroot' do @@ -94,17 +85,6 @@ "url" => 'unix:///run/foreman.sock|http://foreman/', "params" => proxy_pass_params, ) - if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '8') || - (facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04') - should contain_apache__vhost('foreman') - .with_rewrites([ - { - 'comment' => 'Upgrade Websocket connections', - 'rewrite_cond' => '%{HTTP:Upgrade} =websocket [NC]', - 'rewrite_rule' => '/(.*) unix:///run/foreman.sock|ws://foreman/$1 [P,L]', - }, - ]) - end end it 'does not configure the HTTPS vhost' do @@ -127,10 +107,6 @@ class { 'apache': should contain_class('apache::mod::proxy') should contain_class('apache::mod::proxy_http') should contain_class('apache::mod::rewrite') - if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '8') || - (facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04') - should contain_class('apache::mod::proxy_wstunnel') - end end end @@ -251,17 +227,6 @@ class { 'apache': "url" => 'unix:///run/foreman.sock|http://foreman/', "params" => proxy_pass_params, ) - if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '8') || - (facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04') - should contain_apache__vhost('foreman-ssl') - .with_rewrites([ - { - 'comment' => 'Upgrade Websocket connections', - 'rewrite_cond' => '%{HTTP:Upgrade} =websocket [NC]', - 'rewrite_rule' => '/(.*) unix:///run/foreman.sock|ws://foreman/$1 [P,L]', - }, - ]) - end end describe 'with vhost and ssl, no CRL explicitly' do diff --git a/spec/classes/foreman_repo_spec.rb b/spec/classes/foreman_repo_spec.rb index 9a0269e2d..8e124a1fd 100644 --- a/spec/classes/foreman_repo_spec.rb +++ b/spec/classes/foreman_repo_spec.rb @@ -20,14 +20,6 @@ .with_gpgcheck(true) .with_yum_repo_baseurl('https://yum.theforeman.org') } - - it do - if facts[:osfamily] == 'RedHat' && facts[:os]['release']['major'] == '8' - is_expected.to contain_package('foreman').with_ensure('el8').with_provider('dnfmodule') - else - is_expected.not_to contain_package('foreman') - end - end end describe 'with explicit parameters' do diff --git a/spec/classes/foreman_service_spec.rb b/spec/classes/foreman_service_spec.rb index 3438ae006..7f657132c 100644 --- a/spec/classes/foreman_service_spec.rb +++ b/spec/classes/foreman_service_spec.rb @@ -2,7 +2,7 @@ describe 'foreman::service' do let :facts do - on_supported_os['redhat-8-x86_64'] + on_supported_os['redhat-9-x86_64'] end let :params do diff --git a/spec/classes/plugin/remote_execution_cockpit_spec.rb b/spec/classes/plugin/remote_execution_cockpit_spec.rb index ebb92af89..d74f2e7c4 100644 --- a/spec/classes/plugin/remote_execution_cockpit_spec.rb +++ b/spec/classes/plugin/remote_execution_cockpit_spec.rb @@ -69,18 +69,8 @@ class {'foreman': is_expected.to contain_foreman__config__apache__fragment('cockpit') .without_content .with_ssl_content(%r{^$}) - if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '8') || - (facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04') - is_expected.to contain_class('apache::mod::rewrite') - is_expected.to contain_class('apache::mod::proxy_wstunnel') - is_expected.to contain_foreman__config__apache__fragment('cockpit') - .with_ssl_content(%r{^ RewriteRule /webcon/\(\.\*\) ws://127\.0\.0\.1:19090/webcon/\$1 \[P\]$}) - .with_ssl_content(%r{^ ProxyPass http://127\.0\.0\.1:19090/webcon$}) - else - is_expected.to contain_foreman__config__apache__fragment('cockpit') - .without_ssl_content(%r{RewriteRule}) - .with_ssl_content(%r{^ ProxyPass http://127\.0\.0\.1:19090/webcon upgrade=websocket$}) - end + .without_ssl_content(%r{RewriteRule}) + .with_ssl_content(%r{^ ProxyPass http://127\.0\.0\.1:19090/webcon upgrade=websocket$}) end end diff --git a/spec/defines/foreman_rake_spec.rb b/spec/defines/foreman_rake_spec.rb index 7c0336cb2..1f7ccf71b 100644 --- a/spec/defines/foreman_rake_spec.rb +++ b/spec/defines/foreman_rake_spec.rb @@ -5,7 +5,7 @@ context 'on RedHat' do let :facts do - on_supported_os['redhat-8-x86_64'] + on_supported_os['redhat-9-x86_64'] end # These parameters are inherited normally, but here we cheat for performance diff --git a/spec/defines/foreman_repos_apt_spec.rb b/spec/defines/foreman_repos_apt_spec.rb index 6c654a4ab..0da67fe02 100644 --- a/spec/defines/foreman_repos_apt_spec.rb +++ b/spec/defines/foreman_repos_apt_spec.rb @@ -4,7 +4,7 @@ let(:title) { 'foreman' } let :facts do - on_supported_os['debian-11-x86_64'] + on_supported_os['debian-12-x86_64'] end let(:apt_key) do @@ -15,23 +15,23 @@ "foreman" end - context 'with repo => 1.18' do - let(:params) { { repo: '1.18' } } + context 'with repo => 3.13' do + let(:params) { { repo: '3.13' } } it { should contain_class('apt') } - it 'should add the 1.18 repo' do + it 'should add the 3.13 repo' do should contain_apt__source('foreman') .with_location('https://deb.theforeman.org/') - .with_repos('1.18') + .with_repos('3.13') should contain_file('/etc/apt/sources.list.d/foreman.list') - .with_content(%r{deb https://deb\.theforeman\.org/ bullseye 1\.18}) + .with_content(%r{deb https://deb\.theforeman\.org/ bookworm 3\.13}) should contain_apt__source('foreman-plugins') .with_location('https://deb.theforeman.org/') .with_release('plugins') - .with_repos('1.18') + .with_repos('3.13') end it { should contain_apt_key(apt_key_title).with_id(apt_key) } @@ -48,7 +48,7 @@ .with_repos('nightly') should contain_file('/etc/apt/sources.list.d/foreman.list') - .with_content(%r{deb https://deb\.theforeman\.org/ bullseye nightly}) + .with_content(%r{deb https://deb\.theforeman\.org/ bookworm nightly}) should contain_apt__source('foreman-plugins') .with_location('https://deb.theforeman.org/') diff --git a/spec/support/plugin.rb b/spec/support/plugin.rb index f53144f3c..3048a658c 100644 --- a/spec/support/plugin.rb +++ b/spec/support/plugin.rb @@ -1,4 +1,4 @@ -DEFAULT_OS_FACTS = on_supported_os['redhat-8-x86_64'] +DEFAULT_OS_FACTS = on_supported_os['redhat-9-x86_64'] shared_examples 'basic foreman plugin tests' do |name| let(:facts) { DEFAULT_OS_FACTS } diff --git a/templates/cockpit-apache-ssl-rewrite.conf.erb b/templates/cockpit-apache-ssl-rewrite.conf.erb deleted file mode 100644 index 54b8c149d..000000000 --- a/templates/cockpit-apache-ssl-rewrite.conf.erb +++ /dev/null @@ -1,11 +0,0 @@ -### File managed with puppet ### - -> - ProxyPreserveHost On - - RewriteEngine On - RewriteCond %{HTTP:Upgrade} =websocket [NC] - RewriteRule <%= @cockpit_path %>/(.*) ws://<%= @cockpit_host %>:<%= @cockpit_port %><%= @cockpit_path %>/$1 [P] - - ProxyPass http://<%= @cockpit_host %>:<%= @cockpit_port %><%= @cockpit_path %> -