Skip to content

Commit

Permalink
Cleanup old OSes leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury Bushmelev committed Oct 21, 2024
1 parent 61c615c commit d431690
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 722 deletions.
6 changes: 0 additions & 6 deletions manifests/conf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@
# replace whitespace in file name
$cur_file_real = regsubst($cur_file, '\s+', '_', 'G')

if $facts['os']['family'] == 'RedHat' {
if (versioncmp($facts['sudoversion'], '1.7.2p1') < 0) {
warning("Found sudo with version ${facts['sudoversion']}, but at least version 1.7.2p1 is required!")
}
}

if $content != undef {
if $content =~ Array {
$lines = join($content, "\n")
Expand Down
89 changes: 12 additions & 77 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@
$secure_path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/puppetlabs/bin:/snap/bin'
}
default: {
if (versioncmp($facts['os']['release']['major'], '7') >= 0) or
($facts['os']['release']['major'] =~ /\/sid/) or
($facts['os']['release']['major'] =~ /Kali/) {
$content_template = "${content_base}sudoers.debian.erb"
$secure_path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/puppetlabs/bin'
} else {
$content_template = "${content_base}sudoers.olddebian.erb"
$secure_path = undef
}
$content_template = "${content_base}sudoers.debian.erb"
$secure_path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/puppetlabs/bin'
}
}
$package = 'sudo'
Expand All @@ -47,49 +40,23 @@
# in redhat sudo package is already compiled for ldap support
$package_ldap = $package

# rhel 5.0 to 5.4 use sudo 1.6.9 which does not support
# includedir, so we have to make sure sudo 1.7 (comes with rhel
# 5.5) is installed.
$package_ensure = $facts['os']['release']['full'] ? {
/^5.[01234]$/ => 'latest',
default => 'present',
}
$package_ensure = 'present'
$package_source = undef
$package_admin_file = undef
$config_file = '/etc/sudoers'
$config_dir = '/etc/sudoers.d'
case $facts['os']['release']['full'] {
/^5/: {
$content_template = "${content_base}sudoers.rhel5.erb"
$secure_path = undef
$wheel_config = 'absent'
}
/^6/: {
$content_template = "${content_base}sudoers.rhel6.erb"
$secure_path = '/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'
$wheel_config = 'absent'
}
/^7/: {
$content_template = "${content_base}sudoers.rhel7.erb"
$secure_path = '/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin'
$wheel_config = 'password'
}
/^8/: {
$content_template = "${content_base}sudoers.rhel8.erb"
$secure_path = '/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin'
$wheel_config = 'password'
}
/^9/: {
$content_template = "${content_base}sudoers.rhel9.erb"
$secure_path = '/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin'
$wheel_config = 'password'
$content_template = "${content_base}sudoers.rhel.erb"

case [$facts['os']['name'], $facts['os']['release']['major']] {
['Amazon', '2023']: {
$secure_path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/puppetlabs/bin:/var/lib/snapd/snap/bin'
}
default: {
$content_template = "${content_base}sudoers.rhel9.erb"
$secure_path = '/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin'
$wheel_config = 'password'
$secure_path = '/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin'
}
}

$wheel_config = 'password'
$config_file_group = 'root'
$config_dir_keepme = false
$package_provider = undef
Expand Down Expand Up @@ -204,11 +171,7 @@
$defaults = {}
}
'OpenBSD': {
if (versioncmp($facts['kernelversion'], '5.8') < 0) {
$package = undef
} else {
$package = 'sudo'
}
$package = 'sudo'
$package_ldap = undef
$package_ensure = 'present'
$package_source = undef
Expand Down Expand Up @@ -290,34 +253,6 @@
$wheel_config = 'absent'
$defaults = {}
}
'Amazon': {
$package = 'sudo'
$package_ldap = $package
$package_ensure = 'present'
$package_source = undef
$package_admin_file = undef
$config_file = '/etc/sudoers'
$config_dir = '/etc/sudoers.d'
case $facts['os']['release']['full'] {
/^5/: {
$content_template = "${content_base}sudoers.rhel5.erb"
$secure_path = undef
}
/^6/: {
$content_template = "${content_base}sudoers.rhel6.erb"
$secure_path = '/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'
}
default: {
$content_template = "${content_base}sudoers.rhel6.erb"
$secure_path = '/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'
}
}
$config_file_group = 'root'
$config_dir_keepme = false
$package_provider = undef
$wheel_config = 'absent'
$defaults = {}
}
default: {
fail("Unsupported platform: ${facts['os']['family']}/${facts['os']['name']}")
}
Expand Down
30 changes: 0 additions & 30 deletions spec/classes/sudo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,36 +247,6 @@
end
end

describe 'on RedHat 5.4' do
let :facts do
{
os: {
'family' => 'RedHat',
'name' => 'RedHat',
'release' => {
'full' => '5.4',
'major' => '5',
},
},
puppetversion: '3.7.0'
}
end

it do
if params == {}
is_expected.to contain_class('sudo::package').with(
'package' => 'sudo',
'package_ensure' => 'latest'
)
else
is_expected.to contain_class('sudo::package').with(
'package' => 'sudo',
'package_ensure' => param_hash[:package_ensure]
)
end
end
end

describe 'on supported osfamily: AIX' do
let :facts do
{
Expand Down
109 changes: 0 additions & 109 deletions templates/sudoers.olddebian.erb

This file was deleted.

File renamed without changes.
100 changes: 0 additions & 100 deletions templates/sudoers.rhel5.erb

This file was deleted.

Loading

0 comments on commit d431690

Please sign in to comment.