Skip to content

Commit

Permalink
Drop EoL EL8 / Ubuntu 20.04 / Debian 11 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 28e6dd3
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 136 deletions.
22 changes: 2 additions & 20 deletions manifests/config/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""',
Expand All @@ -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 = [
Expand Down
9 changes: 1 addition & 8 deletions manifests/plugin/remote_execution/cockpit.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
12 changes: 6 additions & 6 deletions manifests/providers/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
# OS specific package names
case $facts['os']['family'] {
'RedHat': {
if $is_aio {
$oauth_package = 'puppet-agent-oauth'
$oauth_package = if $is_aio {
'puppet-agent-oauth'
} else {
$oauth_package = 'rubygem-oauth'
'rubygem-oauth'
}
}
'Debian': {
if $is_aio {
$oauth_package = 'puppet-agent-oauth'
$oauth_package = if $is_aio {
'puppet-agent-oauth'
} else {
$oauth_package = 'ruby-oauth'
'ruby-oauth'
}
}
'FreeBSD': {
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
5 changes: 0 additions & 5 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
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
8 changes: 0 additions & 8 deletions spec/classes/foreman_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
14 changes: 2 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,8 @@ 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
.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
16 changes: 8 additions & 8 deletions spec/defines/foreman_repos_apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) }
Expand All @@ -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/')
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
11 changes: 0 additions & 11 deletions templates/cockpit-apache-ssl-rewrite.conf.erb

This file was deleted.

0 comments on commit 28e6dd3

Please sign in to comment.