From a8ea90434607f38f6de9e1af51a96bb2171e176f Mon Sep 17 00:00:00 2001 From: Phil Friderici Date: Wed, 28 Jul 2021 11:14:31 +0000 Subject: [PATCH] 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 %>"