From 450744c1bcf2d2aa72f7474b69bf56c61c65c770 Mon Sep 17 00:00:00 2001 From: Phil Friderici Date: Tue, 20 Jul 2021 09:05:36 +0000 Subject: [PATCH 1/2] Add support for Suse 15 --- README.md | 1 + manifests/init.pp | 5 ++++- metadata.json | 16 +++++++++++++-- spec/classes/init_spec.rb | 34 ++++++++++++++++++++++++++++++++ spec/fixtures/logrotate.suse15 | 36 ++++++++++++++++++++++++++++++++++ templates/sysconfig.suse15.erb | 18 +++++++++++++++++ 6 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 spec/fixtures/logrotate.suse15 create mode 100644 templates/sysconfig.suse15.erb diff --git a/README.md b/README.md index a1e878d..e943114 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ for the exact matrix of supported Puppet and ruby versions. * Suse 10 * Suse 11 * Suse 12 + * Suse 15 * Solaris 10 * Solaris 11 diff --git a/manifests/init.pp b/manifests/init.pp index 92eb83f..3a83984 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -237,8 +237,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}") } } } diff --git a/metadata.json b/metadata.json index 4fc7f82..540e643 100644 --- a/metadata.json +++ b/metadata.json @@ -51,10 +51,22 @@ ] }, { - "operatingsystem": "SLES" + "operatingsystem": "SLES", + "operatingsystemrelease": [ + "10", + "11", + "12", + "15" + ] }, { - "operatingsystem": "SLED" + "operatingsystem": "SLED", + "operatingsystemrelease": [ + "10", + "11", + "12", + "15" + ] }, { "operatingsystem": "Solaris", diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index ff92857..7ff5fc9 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -809,6 +809,7 @@ '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', }, } @@ -1182,6 +1183,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 @@ -1373,6 +1404,7 @@ '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', }, @@ -1420,6 +1452,7 @@ '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, }, } @@ -1461,6 +1494,7 @@ '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, }, } diff --git a/spec/fixtures/logrotate.suse15 b/spec/fixtures/logrotate.suse15 new file mode 100644 index 0000000..7c79eef --- /dev/null +++ b/spec/fixtures/logrotate.suse15 @@ -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 +} diff --git a/templates/sysconfig.suse15.erb b/templates/sysconfig.suse15.erb new file mode 100644 index 0000000..8b27bef --- /dev/null +++ b/templates/sysconfig.suse15.erb @@ -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 %>" From a8ea90434607f38f6de9e1af51a96bb2171e176f Mon Sep 17 00:00:00 2001 From: Phil Friderici Date: Wed, 28 Jul 2021 11:14:31 +0000 Subject: [PATCH 2/2] Add support for EL 8 --- README.md | 4 ++++ manifests/init.pp | 9 ++++++++- metadata.json | 12 ++++++++---- spec/classes/init_spec.rb | 34 +++++++++++++++++++++++++++++++++ spec/fixtures/logrotate.redhat8 | 15 +++++++++++++++ templates/sysconfig.rhel8.erb | 8 ++++++++ 6 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 spec/fixtures/logrotate.redhat8 create mode 100644 templates/sysconfig.rhel8.erb diff --git a/README.md b/README.md index e943114..98ca5b6 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ for the exact matrix of supported Puppet and ruby versions. * EL 5 * EL 6 * EL 7 + * EL 8 [*] * Suse 10 * Suse 11 * Suse 12 @@ -30,6 +31,9 @@ for the exact matrix of supported Puppet and ruby versions. * 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 diff --git a/manifests/init.pp b/manifests/init.pp index 3a83984..f065562 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 diff --git a/metadata.json b/metadata.json index 540e643..92eb2a7 100644 --- a/metadata.json +++ b/metadata.json @@ -23,7 +23,8 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { @@ -31,7 +32,8 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { @@ -39,7 +41,8 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { @@ -47,7 +50,8 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 7ff5fc9..e0f44df 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -805,6 +805,7 @@ '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', }, @@ -1082,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 { @@ -1399,6 +1430,7 @@ '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', }, @@ -1448,6 +1480,7 @@ '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, }, @@ -1490,6 +1523,7 @@ '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, }, diff --git a/spec/fixtures/logrotate.redhat8 b/spec/fixtures/logrotate.redhat8 new file mode 100644 index 0000000..ff4ebc3 --- /dev/null +++ b/spec/fixtures/logrotate.redhat8 @@ -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 +} diff --git a/templates/sysconfig.rhel8.erb b/templates/sysconfig.rhel8.erb new file mode 100644 index 0000000..28454e1 --- /dev/null +++ b/templates/sysconfig.rhel8.erb @@ -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 %>"