Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Suse 15 an EL 8 #130

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ for the exact matrix of supported Puppet and ruby versions.
* EL 5
* EL 6
* EL 7
* EL 8 [*]
* Suse 10
* Suse 11
* Suse 12
* Suse 15
* Solaris 10
* Solaris 11

[*] This module support the `basic` configuration format for rsyslog.
EL 8 by default utilize the `advanced` configuration format but is compatible with `basic` configurations as well.

===

# Examples
Expand Down
14 changes: 12 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,15 @@
$default_mod_imjournal = true
$default_manage_devlog = true
}
/^8\.*/: {
$default_pid_file = '/var/run/syslogd.pid'
$sysconfig_erb = 'sysconfig.rhel8.erb'
$default_syslogd_options = undef
$default_mod_imjournal = true
$default_manage_devlog = true
}
default: {
fail("rsyslog supports RedHat like systems with major release of 5, 6 and 7 and you have ${::operatingsystemrelease}")
fail("rsyslog supports RedHat like systems with major release of 5, 6, 7 and 8 and you have ${::operatingsystemrelease}")
}
}
# ensures that sysklogd is absent, which is needed on EL5
Expand Down Expand Up @@ -237,8 +244,11 @@
/^12\.*/ : {
$sysconfig_erb = 'sysconfig.suse12.erb'
}
/^15\.*/ : {
$sysconfig_erb = 'sysconfig.suse15.erb'
}
default: {
fail("rsyslog supports Suse like systems with major release 10 and 11, and you have ${::operatingsystemrelease}")
fail("rsyslog supports Suse like systems with major release 10, 11, 12 and 15, and you have ${::operatingsystemrelease}")
}
}
}
Expand Down
28 changes: 22 additions & 6 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,54 @@
"operatingsystemrelease": [
"5",
"6",
"7"
"7",
"8"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"5",
"6",
"7"
"7",
"8"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"5",
"6",
"7"
"7",
"8"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"5",
"6",
"7"
"7",
"8"
]
},
{
"operatingsystem": "SLES"
"operatingsystem": "SLES",
"operatingsystemrelease": [
"10",
"11",
"12",
"15"
]
},
{
"operatingsystem": "SLED"
"operatingsystem": "SLED",
"operatingsystemrelease": [
"10",
"11",
"12",
"15"
]
},
{
"operatingsystem": "Solaris",
Expand Down
68 changes: 68 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,12 @@
'redhat5' => { :osfamily => 'RedHat', :release => '5.10', :kernel => 'Linux', },
'redhat6' => { :osfamily => 'RedHat', :release => '6.5', :kernel => 'Linux', },
'redhat7' => { :osfamily => 'RedHat', :release => '7.0.1406', :kernel => 'Linux', },
'redhat8' => { :osfamily => 'RedHat', :release => '8.0', :kernel => 'Linux', },
'debian7' => { :osfamily => 'Debian', :release => '7.3', :kernel => 'Linux', },
'suse10' => { :osfamily => 'Suse', :release => '10.1', :kernel => 'Linux', },
'suse11' => { :osfamily => 'Suse', :release => '11.1', :kernel => 'Linux', },
'suse12' => { :osfamily => 'Suse', :release => '12.1', :kernel => 'Linux', },
'suse15' => { :osfamily => 'Suse', :release => '15.1', :kernel => 'Linux', },
'solaris10' => { :osfamily => 'Solaris', :release => '5.10', :kernel => 'Solaris', },
'solaris11' => { :osfamily => 'Solaris', :release => '5.11', :kernel => 'Solaris', },
}
Expand Down Expand Up @@ -1081,6 +1083,36 @@
end
end

context 'on EL 8' do
let :facts do
{
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystemrelease => '8.0',
}
end

context 'with default params' do
it {
should contain_file('rsyslog_sysconfig').with({
'path' => '/etc/sysconfig/rsyslog',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'require' => 'Package[rsyslog]',
'notify' => 'Service[rsyslog_daemon]',
})
}
it { should contain_file('rsyslog_sysconfig').with_content(/^SYSLOGD_OPTIONS=""$/) }
end

context 'with syslogd_options specified as valid value' do
let(:params) { { :syslogd_options => '-c0' } }

it { should contain_file('rsyslog_sysconfig').with_content(/^SYSLOGD_OPTIONS="-c0"$/) }
end
end

context 'on Suse 10' do
let :facts do
{
Expand Down Expand Up @@ -1182,6 +1214,36 @@
it { should contain_file('rsyslog_sysconfig').with_content(/^RSYSLOGD_PARAMS="-c0"$/) }
end
end

context 'on Suse 15' do
let :facts do
{
:kernel => 'Linux',
:osfamily => 'Suse',
:operatingsystemrelease => '15.0',
}
end

context 'with default params' do
it {
should contain_file('rsyslog_sysconfig').with({
'path' => '/etc/sysconfig/syslog',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'require' => 'Package[rsyslog]',
'notify' => 'Service[rsyslog_daemon]',
})
}
it { should contain_file('rsyslog_sysconfig').with_content(/^RSYSLOGD_PARAMS=""$/) }
end

context 'with syslogd_options specified as valid value' do
let(:params) { { :syslogd_options => '-c0' } }

it { should contain_file('rsyslog_sysconfig').with_content(/^RSYSLOGD_PARAMS="-c0"$/) }
end
end
end

describe 'rsyslog_d_dir' do
Expand Down Expand Up @@ -1368,11 +1430,13 @@
'redhat5' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '5.10', :support => 'supported', },
'redhat6' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '6.5', :support => 'supported', },
'redhat7' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '7.0.1406', :support => 'supported', },
'redhat8' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '8.0', :support => 'supported', },
'debian7' => { :kernel => 'Linux', :osfamily => 'Debian', :release => '7.3', :support => 'supported', },
'suse9' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '9.1', :support => 'unsupported', },
'suse10' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '10.2', :support => 'supported', },
'suse11' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '11.1', :support => 'supported', },
'suse12' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '12.1', :support => 'supported', },
'suse15' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '15.1', :support => 'supported', },
'solaris9' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.9', :support => 'unsupported', },
'solaris10' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.10', :support => 'supported', },
'solaris11' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.11', :support => 'supported', },
Expand Down Expand Up @@ -1416,10 +1480,12 @@
'redhat5' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '5', :mod_imjournal => false, },
'redhat6' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '6', :mod_imjournal => false, },
'redhat7' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '7', :mod_imjournal => true, },
'redhat8' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '8', :mod_imjournal => true, },
'debian7' => { :kernel => 'Linux', :osfamily => 'Debian', :release => '7', :mod_imjournal => false, },
'suse10' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '10', :mod_imjournal => false, },
'suse11' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '11', :mod_imjournal => false, },
'suse12' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '12', :mod_imjournal => false, },
'suse15' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '15', :mod_imjournal => false, },
'solaris10' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.10', :mod_imjournal => false, },
'solaris11' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.11', :mod_imjournal => false, },
}
Expand Down Expand Up @@ -1457,10 +1523,12 @@
'redhat5' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '5', :manage_devlog => false, },
'redhat6' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '6', :manage_devlog => false, },
'redhat7' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '7', :manage_devlog => true, },
'redhat8' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '8', :manage_devlog => true, },
'debian7' => { :kernel => 'Linux', :osfamily => 'Debian', :release => '7', :manage_devlog => false, },
'suse10' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '10', :manage_devlog => false, },
'suse11' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '11', :manage_devlog => false, },
'suse12' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '12', :manage_devlog => false, },
'suse15' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '15', :manage_devlog => false, },
'solaris10' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.10', :manage_devlog => false, },
'solaris11' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.11', :manage_devlog => false, },
}
Expand Down
15 changes: 15 additions & 0 deletions spec/fixtures/logrotate.redhat8
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is being maintained by Puppet.
# DO NOT EDIT

/var/log/messages
/var/log/secure
/var/log/maillog
/var/log/spooler
/var/log/boot.log
/var/log/cron
{
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
36 changes: 36 additions & 0 deletions spec/fixtures/logrotate.suse15
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file is being maintained by Puppet.
# DO NOT EDIT

/var/log/messages
/var/log/secure
/var/log/maillog
/var/log/spooler
/var/log/boot.log
/var/log/cron
/var/log/warn
/var/log/allmessages
/var/log/localmessages
/var/log/firewall
/var/log/acpid
/var/log/NetworkManager
/var/log/mail
/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/news/news.crit
/var/log/news/news.err
/var/log/news/news.notice
{
compress
dateext
maxage 365
rotate 99
missingok
notifempty
size +4096k
create 640 root root
sharedscripts
postrotate
/sbin/service syslog reload > /dev/null
endscript
}
8 changes: 8 additions & 0 deletions templates/sysconfig.rhel8.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is being maintained by Puppet.
# DO NOT EDIT
#
# Options for rsyslogd
# Syslogd options are deprecated since rsyslog v3.
# If you want to use them, switch to compatibility mode 2 by "-c 2"
# See rsyslogd(8) for more details
SYSLOGD_OPTIONS="<%= @syslogd_options_real %>"
18 changes: 18 additions & 0 deletions templates/sysconfig.suse15.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is being maintained by Puppet.
# DO NOT EDIT

## Type: string
## Default: ""
## Config: ""
## ServiceRestart: syslog
#
# Parameters for rsyslogd, except of the version compatibility (-c)
# and the config file (-f), because they're used by sysconfig and
# earlysysconfig init scripts.
#
# See also the RSYSLOGD_COMPAT_VERSION variable in this file, the
# documentation provided in /usr/share/doc/packages/rsyslog/doc by
# the rsyslog-doc package and the rsyslogd(8) and rsyslog.conf(5)
# manual pages.
#
RSYSLOGD_PARAMS="<%= @syslogd_options_real %>"