From dc1c54825cdabe281b56d5b34e6b257e2ac58c38 Mon Sep 17 00:00:00 2001 From: Klaas Demter Date: Wed, 19 Oct 2016 11:07:41 +0200 Subject: [PATCH] update params.pp for sles12 and fix tests --- README.md | 2 +- manifests/params.pp | 19 ++++++++++++++----- spec/classes/init_spec.rb | 16 ++++++++++++---- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index cf51d88..3d574d5 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,7 @@ If **true** then **/etc/audit/rules.d/** will be managed by this module. This me Defaults: -* EL7: `true` +* EL7/SLES12: `true` * Others: `false` #### `rules_file` diff --git a/manifests/params.pp b/manifests/params.pp index 8763979..1d7d680 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,11 +21,20 @@ } 'Suse': { $package_name = 'audit' - $audisp_package = 'audispd-plugins' - $manage_audit_files = false - $rules_file = '/etc/audit/audit.rules' - $service_restart = '/etc/init.d/auditd restart' - $service_stop = '/etc/init.d/auditd stop' + if versioncmp($::operatingsystemrelease, '12') >= 0 and $::operatingsystem == 'SLES' { + $audisp_package = 'audit-audispd-plugins' + $manage_audit_files = true + $rules_file = '/etc/audit/rules.d/puppet.rules' + $service_restart = '/bin/systemctl restart auditd' + $service_stop = '/bin/systemctl stop auditd' + } + else { + $audisp_package = 'audispd-plugins' + $manage_audit_files = false + $rules_file = '/etc/audit/audit.rules' + $service_restart = '/etc/init.d/auditd restart' + $service_stop = '/etc/init.d/auditd stop' + } } 'RedHat': { $package_name = 'audit' diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 2c4c12a..cc13f7d 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -3,6 +3,7 @@ context 'default parameters on RedHat 7' do let (:facts) {{ :osfamily => 'RedHat', + :operatingsystem => 'RedHat', :operatingsystemrelease => '7', :concat_basedir => '/var/lib/puppet/concat', }} @@ -39,6 +40,7 @@ context 'default parameters on RedHat 6' do let (:facts) {{ :osfamily => 'RedHat', + :operatingsystem => 'RedHat', :operatingsystemrelease => '6', :concat_basedir => '/var/lib/puppet/concat', }} @@ -52,6 +54,7 @@ context 'default parameters on Amazon Linux' do let (:facts) {{ :osfamily => 'RedHat', + :operatingsystem => 'RedHat', :operatingsystemrelease => '7', :operatingsystem => 'Amazon', :concat_basedir => '/var/lib/puppet/concat', @@ -66,6 +69,7 @@ context 'default parameters on Debian 8' do let (:facts) {{ :osfamily => 'Debian', + :operatingsystem => 'Debian', :lsbmajdistrelease => '8', :concat_basedir => '/var/lib/puppet/concat', }} @@ -80,6 +84,7 @@ context 'default parameteres on Ubuntu 14.04' do let (:facts) {{ :osfamily => 'Debian', + :operatingsystem => 'Debian', :operatingsystem => 'Ubuntu', :lsbmajdistrelease => '14.04', :concat_basedir => '/var/lib/puppet/concat', @@ -94,8 +99,9 @@ end context 'default parameters on Archlinux' do let (:facts) {{ - :osfamily => 'Archlinux', - :concat_basedir => '/var/lib/puppet/concat', + :osfamily => 'Archlinux', + :operatingsystem => 'Archlinux', + :concat_basedir => '/var/lib/puppet/concat', }} it { should contain_package('audit') @@ -107,8 +113,9 @@ end context 'default parameters on Gentoo' do let (:facts) {{ - :osfamily => 'Gentoo', - :concat_basedir => '/var/lib/puppet/concat', + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :concat_basedir => '/var/lib/puppet/concat', }} it { should contain_package('audit') @@ -121,6 +128,7 @@ context 'auditd.conf is well-formed' do let (:facts) {{ :osfamily => 'RedHat', + :operatingsystem => 'RedHat', :operatingsystemrelease => '7', }} it {