diff --git a/data/default.yaml b/data/default.yaml index 6515103..f87cece 100644 --- a/data/default.yaml +++ b/data/default.yaml @@ -3,6 +3,7 @@ patterndb::base_dir: / patterndb::temp_dir: /tmp/syslog-ng patterndb::package_name: false patterndb::manage_package: true +patterndb::package_name: syslog-ng patterndb::syslogng_modules: [] patterndb::use_hiera: false patterndb::_manage_top_dirs: true diff --git a/data/osfamily/Debian.yaml b/data/osfamily/Debian.yaml new file mode 100644 index 0000000..4191941 --- /dev/null +++ b/data/osfamily/Debian.yaml @@ -0,0 +1,2 @@ +--- +patterndb::package_name: syslog-ng-core diff --git a/manifests/init.pp b/manifests/init.pp index 59c409e..d55d222 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,8 +1,8 @@ # class patterndb ( + String[1] $package_name, String[1] $base_dir = '/', String[1] $temp_dir = "${base_dir}/tmp/syslog-ng", - Variant[String[1],Boolean] $package_name = false, Boolean $manage_package = true, Array[String[1]] $syslogng_modules = [], Boolean $use_hiera = false, @@ -11,17 +11,7 @@ ) { # package if $manage_package { - if $package_name =~ String { - $real_package_name = $package_name - } else { - case $facts['os']['family'] { - 'RedHat': { $real_package_name = 'syslog-ng' } - 'Debian': { $real_package_name = 'syslog-ng-core' } - 'FreeBSD': { $real_package_name = 'syslog-ng' } - default: { fail("unsupported osfamily: ${facts['os']['family']}") } - } - } - ensure_resource ( 'package', $real_package_name, { 'ensure' => 'installed' }) + ensure_resource ( 'package', $package_name, { 'ensure' => 'installed' }) } ensure_resource ( 'file', $temp_dir, { ensure => directory }) if $_manage_top_dirs { diff --git a/spec/classes/patterndb_spec.rb b/spec/classes/patterndb_spec.rb index 722d436..ff387a9 100644 --- a/spec/classes/patterndb_spec.rb +++ b/spec/classes/patterndb_spec.rb @@ -37,13 +37,6 @@ end end end - context 'Unsupported OS without package_name' do - let :facts do - { osfamily: 'UnsupportedOne' } - end - - it { is_expected.to raise_error(Puppet::Error) } - end context 'Any OS with a package name' do let :params do