Skip to content

Commit

Permalink
Drop EoL EL8 / Ubuntu 20.04 support
Browse files Browse the repository at this point in the history
Foreman 3.13.0 doesn't provide packages for those platforms anymore.
  • Loading branch information
bastelfreak committed Dec 18, 2024
1 parent 0e8bb06 commit 3481b70
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 95 deletions.
18 changes: 2 additions & 16 deletions manifests/config/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,8 @@
}

# 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_rewrites = []
$_proxy_params = $proxy_params + { 'upgrade' => 'websocket' }

$vhost_http_request_headers = [
'set X_FORWARDED_PROTO "http"',
Expand Down
9 changes: 0 additions & 9 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"8",
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"8",
"9"
]
},
Expand All @@ -76,14 +74,12 @@
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"20.04",
"22.04"
]
},
{
"operatingsystem": "AlmaLinux",
"operatingsystemrelease": [
"8",
"9"
]
}
Expand Down
10 changes: 0 additions & 10 deletions spec/acceptance/foreman_cli_plugins_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
37 changes: 1 addition & 36 deletions spec/classes/foreman_config_apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions spec/classes/foreman_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
}

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
is_expected.not_to contain_package('foreman')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/foreman_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 3 additions & 12 deletions spec/classes/plugin/remote_execution_cockpit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,9 @@ class {'foreman':
is_expected.to contain_foreman__config__apache__fragment('cockpit')
.without_content
.with_ssl_content(%r{^<Location /webcon>$})
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
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
end

Expand Down
2 changes: 1 addition & 1 deletion spec/defines/foreman_rake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/support/plugin.rb
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down

0 comments on commit 3481b70

Please sign in to comment.