From a379d554c810e0d37960c7fe9bff3e7bbf1eade8 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 20 Dec 2024 14:15:09 -0800 Subject: [PATCH 1/2] fix default su_group on ubuntu 22.04+ --- manifests/params.pp | 9 ++++++++- metadata.json | 4 +++- spec/classes/defaults_spec.rb | 34 ++++++++++++++++++++++------------ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 64593b4..4161df4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -30,10 +30,17 @@ 'Ubuntu' => 'root', default => undef, } + + $ubuntu_default_su_group = $facts['os']['release']['full'] ? { + '18.04' => 'syslog', + default => 'adm', + } + $default_su_group = $facts['os']['name'] ? { - 'Ubuntu' => 'syslog', + 'Ubuntu' => $ubuntu_default_su_group, default => undef } + $conf_params = { su => $default_su, su_user => $default_su_user, diff --git a/metadata.json b/metadata.json index f633ea8..b0456c4 100644 --- a/metadata.json +++ b/metadata.json @@ -80,7 +80,9 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04" + "18.04", + "22.04", + "24.04" ] }, { diff --git a/spec/classes/defaults_spec.rb b/spec/classes/defaults_spec.rb index a5eb19b..9204fcb 100644 --- a/spec/classes/defaults_spec.rb +++ b/spec/classes/defaults_spec.rb @@ -18,19 +18,8 @@ let(:facts) { os_facts } it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_logrotate__conf('/etc/logrotate.conf') } - if os_facts['os']['name'] == 'Ubuntu' - it { - is_expected.to contain_logrotate__conf('/etc/logrotate.conf').with( - 'su_user' => 'root', - 'su_group' => 'syslog' - ) - } - else - it { - is_expected.to contain_logrotate__conf('/etc/logrotate.conf') - } - end it { is_expected.to contain_logrotate__rule('wtmp').with( 'rotate_every' => 'monthly', @@ -56,6 +45,27 @@ } end + context os, if: os_facts['os']['name'] == 'Ubuntu' do + let(:facts) { os_facts } + + if os_facts['os']['release']['full'] == '18.04' + it { + is_expected.to contain_logrotate__conf('/etc/logrotate.conf').with( + 'su_user' => 'root', + 'su_group' => 'syslog' + ) + } + end + if os_facts['os']['release']['full'] == '22.04' + it { + is_expected.to contain_logrotate__conf('/etc/logrotate.conf').with( + 'su_user' => 'root', + 'su_group' => 'adm' + ) + } + end + end + context os, if: os_facts['os']['family'] == 'RedHat' do let(:facts) { os_facts } From 56def732dc3d11bceef2aa440506ff9b420cb0b3 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 20 Dec 2024 14:24:23 -0800 Subject: [PATCH 2/2] add ubuntu 20.04 support --- metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/metadata.json b/metadata.json index b0456c4..40beea8 100644 --- a/metadata.json +++ b/metadata.json @@ -81,6 +81,7 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "18.04", + "20.04", "22.04", "24.04" ]