Skip to content

Commit

Permalink
Drop EL7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Jun 28, 2022
1 parent ed4a366 commit f817b5b
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 221 deletions.
2 changes: 0 additions & 2 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ Gemfile:
spec/spec_helper.rb:
requires:
- webmock/rspec
spec/spec_helper_acceptance.rb:
locale_workaround: true
17 changes: 1 addition & 16 deletions manifests/cli/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,11 @@
# OS specific paths
case $facts['os']['family'] {
'RedHat': {
# We use system packages except on EL7
if versioncmp($facts['os']['release']['major'], '8') >= 0 {
$_hammer_plugin_prefix = 'rubygem-hammer_cli_'
} else {
$_hammer_plugin_prefix = 'tfm-rubygem-hammer_cli_'
}
$_hammer_plugin_prefix = 'rubygem-hammer_cli_'
}
'Debian': {
$_hammer_plugin_prefix = 'ruby-hammer-cli-'
}
'Linux': {
case $facts['os']['name'] {
'Amazon': {
$_hammer_plugin_prefix = 'tfm-rubygem-hammer_cli_'
}
default: {
fail("${facts['networking']['hostname']}: This module does not support operatingsystem ${facts['os']['name']}")
}
}
}
/(ArchLinux|Suse)/: {
$_hammer_plugin_prefix = undef
}
Expand Down
7 changes: 0 additions & 7 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
}
}

# Foreman 2.5 dropped support for Passenger. On EL7 there was a native package built for SCL that should be absent.
if $foreman::passenger_ruby_package {
package { $foreman::passenger_ruby_package:
ensure => absent,
}
}

package { 'foreman-service':
ensure => $foreman::version,
}
Expand Down
27 changes: 1 addition & 26 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -85,38 +85,13 @@
# OS specific paths
case $facts['os']['family'] {
'RedHat': {
# We use system packages except on EL7
if versioncmp($facts['os']['release']['major'], '8') >= 0 {
$passenger_ruby_package = undef
$_plugin_prefix = 'rubygem-foreman_'
$configure_scl_repo = false
} else {
$passenger_ruby_package = 'tfm-rubygem-passenger-native'
$_plugin_prefix = 'tfm-rubygem-foreman_'
$configure_scl_repo = true
}

$_plugin_prefix = 'rubygem-foreman_'
$user_shell = '/sbin/nologin'
}
'Debian': {
$passenger_ruby_package = undef
$_plugin_prefix = 'ruby-foreman-'
$configure_scl_repo = false
$user_shell = '/usr/sbin/nologin'
}
'Linux': {
case $facts['os']['name'] {
'Amazon': {
$passenger_ruby_package = 'tfm-rubygem-passenger-native'
$_plugin_prefix = 'tfm-rubygem-foreman_'
$configure_scl_repo = true
$user_shell = '/sbin/nologin'
}
default: {
fail("${facts['networking']['hostname']}: This module does not support operatingsystem ${facts['os']['name']}")
}
}
}
default: {
fail("${facts['networking']['hostname']}: This module does not support osfamily ${facts['os']['family']}")
}
Expand Down
14 changes: 0 additions & 14 deletions manifests/providers/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,6 @@
'Archlinux': {
$oauth_package = 'ruby-oauth'
}
'Linux': {
case $facts['os']['name'] {
'Amazon': {
if $is_aio {
$oauth_package = 'puppet-agent-oauth'
} else {
$oauth_package = 'rubygem-oauth'
}
}
default: {
fail("${facts['networking']['hostname']}: This class does not support operatingsystem ${facts['os']['name']}")
}
}
}
default: {
fail("${facts['networking']['hostname']}: This class does not support osfamily ${facts['os']['family']}")
}
Expand Down
28 changes: 1 addition & 27 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@
# @param repo
# The repository version to manage. This can be a specific version or nightly
#
# @param configure_scl_repo
# If disabled the SCL repo will not be configured on Red Hat clone systems.
# (Currently only installs repos for CentOS and Scientific)
#
# @param gpgcheck
# Turn on/off gpg check in repo files (effective only on RedHat family systems)
#
# @param scl_repo_ensure
# The ensure to set on the SCL repo package
#
# @param yum_repo_baseurl
# The base URL for Yum repositories
class foreman::repo (
Optional[Variant[Enum['nightly'], Pattern['^\d+\.\d+$']]] $repo = undef,
Boolean $gpgcheck = true,
Boolean $configure_scl_repo = $facts['os']['name'] == 'CentOS' and $facts['os']['release']['major'] == '7',
String $scl_repo_ensure = 'installed',
Stdlib::HTTPUrl $yum_repo_baseurl = 'https://yum.theforeman.org',
) {
if $repo {
Expand All @@ -30,30 +21,13 @@
before => Anchor['foreman::repo'],
}

if $configure_scl_repo {
Foreman::Repos['foreman'] -> Package['centos-release-scl-rh']
}

if $facts['os']['release']['major'] == '8' and ($repo == 'nightly' or versioncmp($repo, '3.2') >= 0) {
if $facts['os']['family'] == 'RedHat' {
package { 'foreman':
ensure => "el${facts['os']['release']['major']}",
enable_only => true,
provider => 'dnfmodule',
require => Foreman::Repos['foreman'],
}
} elsif $facts['os']['release']['major'] == '8' and versioncmp($repo, '2.5') >= 0 {
package { 'ruby':
ensure => '2.7',
enable_only => true,
provider => 'dnfmodule',
}
}
}

if $configure_scl_repo {
package { 'centos-release-scl-rh':
ensure => $scl_repo_ensure,
before => Anchor['foreman::repo'],
}
}

Expand Down
10 changes: 2 additions & 8 deletions manifests/repos.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
Boolean $gpgcheck = true,
) {
case $facts['os']['family'] {
'RedHat', 'Linux': {
$yumcode = $facts['os']['name'] ? {
'Amazon' => 'el7',
'Fedora' => "f${facts['os']['release']['major']}",
default => "el${facts['os']['release']['major']}",
}

'RedHat': {
foreman::repos::yum { $name:
repo => $repo,
yumcode => $yumcode,
yumcode => "el${facts['os']['release']['major']}",
gpgcheck => $gpgcheck,
baseurl => $yum_repo_baseurl,
}
Expand Down
8 changes: 0 additions & 8 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,15 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7",
"8"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"8"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"7"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
Expand Down
20 changes: 8 additions & 12 deletions spec/acceptance/foreman_cli_plugins_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
describe 'Scenario: install foreman-cli + plugins without foreman' do
before(:context) { purge_foreman }

package_prefix = fact('os.release.major') == '7' ? "tfm-" : ""

context 'for standard plugins' do

it_behaves_like 'an idempotent resource' do
Expand Down Expand Up @@ -36,7 +34,7 @@ class { 'foreman::cli':
['discovery', 'host_reports', 'remote_execution', 'tasks', 'templates', 'webhooks', 'puppet'].each do |plugin|
package_name = case fact('os.family')
when 'RedHat'
"#{package_prefix}rubygem-hammer_cli_foreman_#{plugin}"
"rubygem-hammer_cli_foreman_#{plugin}"
when 'Debian'
"ruby-hammer-cli-foreman-#{plugin.tr('_', '-')}"
else
Expand All @@ -59,15 +57,13 @@ 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']
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',
Expand All @@ -84,7 +80,7 @@ class { 'foreman::cli':

it_behaves_like 'hammer'

package_name = "#{package_prefix}rubygem-hammer_cli_katello"
package_name = "rubygem-hammer_cli_katello"
describe package(package_name) do
it { is_expected.to be_installed }
end
Expand Down
8 changes: 2 additions & 6 deletions spec/acceptance/foreman_journald_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@ class { 'foreman':
it { is_expected.to be_installed }
end

# Logging to the journal is broken on Docker 18+ and EL7 but works in Vagrant
# VMs (and EL7's Docker version)
broken_journald_logging = ENV['BEAKER_HYPERVISOR'] == 'docker' && os[:family] == 'redhat' && os[:release] =~ /^7\./

describe command('journalctl -u foreman'), unless: broken_journald_logging do
describe command('journalctl -u foreman') do
its(:stdout) { is_expected.to match(%r{Redirected to https://#{host_inventory['fqdn']}/users/login}) }
end

describe command('journalctl -u dynflow-sidekiq@orchestrator'), unless: broken_journald_logging do
describe command('journalctl -u dynflow-sidekiq@orchestrator') do
its(:stdout) { is_expected.to match(%r{Everything ready for world: }) }
end
end
11 changes: 0 additions & 11 deletions spec/acceptance/hieradata/os/RedHat/7.yaml

This file was deleted.

44 changes: 1 addition & 43 deletions spec/classes/foreman_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_anchor('foreman::repo') }
it { is_expected.not_to contain_foreman__repos('foreman') }

it do
if facts[:operatingsystem] == 'CentOS' && facts[:operatingsystemmajrelease] == '7'
is_expected.to contain_package('centos-release-scl-rh')
else
is_expected.not_to contain_package('centos-release-scl-rh')
end
end
end

describe 'with minimal parameters' do
Expand All @@ -30,15 +22,7 @@
}

it do
if facts[:operatingsystem] == 'CentOS' && facts[:operatingsystemmajrelease] == '7'
is_expected.to contain_package('centos-release-scl-rh')
else
is_expected.not_to contain_package('centos-release-scl-rh')
end
end

it do
if facts[:operatingsystemmajrelease] == '8'
if facts[:osfamily] == 'RedHat'
is_expected.to contain_package('foreman').with_ensure('el8').with_provider('dnfmodule')
else
is_expected.not_to contain_package('ruby')
Expand All @@ -50,7 +34,6 @@
let :params do
{
repo: '1.19',
configure_scl_repo: false,
yum_repo_baseurl: 'https://example.org'
}
end
Expand All @@ -63,31 +46,6 @@
.with_gpgcheck(true)
.with_yum_repo_baseurl('https://example.org')
end

it { is_expected.not_to contain_package('centos-release-scl-rh') }

it do
is_expected.not_to contain_package('ruby')
end
end

describe 'with repo set to 2.5' do
let :params do
{
repo: '2.5',
configure_scl_repo: false
}
end

it { is_expected.to compile.with_all_deps }

it do
if facts[:operatingsystemmajrelease] == '8'
is_expected.to contain_package('ruby').with_ensure('2.7').with_provider('dnfmodule')
else
is_expected.not_to contain_package('ruby')
end
end
end
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-7-x86_64']
on_supported_os['redhat-8-x86_64']
end

let :params do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/plugin/ovirt_provision_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
let(:package_name) do
case facts[:osfamily]
when 'RedHat'
facts[:os]['release']['major'] == '7' ? 'tfm-rubygem-ovirt_provision_plugin' : 'rubygem-ovirt_provision_plugin'
'rubygem-ovirt_provision_plugin'
when 'Debian'
'ruby-ovirt_provision_plugin'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/plugin/puppetdb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
let(:package_name) do
case facts[:osfamily]
when 'RedHat'
facts[:os]['release']['major'] == '7' ? 'tfm-rubygem-puppetdb_foreman' : 'rubygem-puppetdb_foreman'
'rubygem-puppetdb_foreman'
when 'Debian'
'ruby-puppetdb_foreman'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/plugin/tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let(:package_name) do
case facts[:osfamily]
when 'RedHat'
facts[:os]['release']['major'] == '7' ? 'tfm-rubygem-foreman-tasks' : 'rubygem-foreman-tasks'
'rubygem-foreman-tasks'
when 'Debian'
'ruby-foreman-tasks'
end
Expand Down
Loading

0 comments on commit f817b5b

Please sign in to comment.