diff --git a/README.md b/README.md index d2e861a..78c4644 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,12 @@ This module will manage the pattern databases of *syslog-ng* by using existing f ### What patterndb affects -Depending on the top-level configuration variables `$base_dir` and `$temp_dir`, this module will manage and execute the following elements in order: +Depending on the top-level configuration variables `$base_dir` and `$cache_dir`, this module will manage and execute the following elements in order: 0. (OPTIONAL) Manage package `syslog-ng` 1. Manage `$base_dir/etc/syslog-ng/patterndb.d` recursively 2. Manage the contents of the above directory using [existing](#defined-type-patterndbrawruleset) or [generated](#defined-type-patterndbsimpleruleset) patterndb *ruleset* files -3. Merge the contents of the latter using `pdbtool` into a temporary file `${temp_dir}/syslog-ng/patterndb/${parser}.xml` where `$parser` is the name of the *patterndb* (you can have as many as you want, *e.g.* for *staged parsing*. +3. Merge the contents of the latter using `pdbtool` into a temporary file `${cache_dir}/syslog-ng/patterndb/${parser}.xml` where `$parser` is the name of the *patterndb* (you can have as many as you want, *e.g.* for *staged parsing*. 4. (OPTIONAL) Test the resulting patterndbs 5. Deploy the temporary files into `${base_dir}/var/lib/syslog-ng/patterndb/${parser}.xml` diff --git a/data/default.yaml b/data/default.yaml index 605edb4..91348fd 100644 --- a/data/default.yaml +++ b/data/default.yaml @@ -1,6 +1,5 @@ --- patterndb::base_dir: / -patterndb::temp_dir: /tmp/syslog-ng patterndb::package_name: false patterndb::manage_package: true patterndb::package_name: syslog-ng diff --git a/manifests/init.pp b/manifests/init.pp index 954990a..d439f86 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -2,8 +2,8 @@ class patterndb ( String[1] $package_name, Stdlib::Absolutepath $config_dir, + Stdlib::Absolutepath $cache_dir = '/var/cache/syslog-ng', String[1] $base_dir = '/', - String[1] $temp_dir = "${base_dir}/tmp/syslog-ng", Boolean $manage_package = true, Array[String[1]] $syslogng_modules = [], Boolean $use_hiera = false, @@ -13,7 +13,7 @@ if $manage_package { ensure_resource ( 'package', $package_name, { 'ensure' => 'installed' }) } - ensure_resource ( 'file', $temp_dir, { ensure => directory }) + ensure_resource ( 'file', $cache_dir, { ensure => directory }) ensure_resource ( 'file', "${base_dir}/var/lib/syslog-ng", { ensure => 'directory' } diff --git a/manifests/parser.pp b/manifests/parser.pp index ed4954e..af2261f 100644 --- a/manifests/parser.pp +++ b/manifests/parser.pp @@ -21,7 +21,7 @@ 'force' => true, 'recurse' => true, }) - ensure_resource ('file', "${patterndb::temp_dir}/patterndb", { + ensure_resource ('file', "${patterndb::cache_dir}/patterndb", { 'ensure' => 'directory', }) ensure_resource ('file', "patterndb::file::${name}", { @@ -29,22 +29,22 @@ 'path' => "${patterndb::base_dir}/var/lib/syslog-ng/patterndb/${name}.xml" }) exec { "patterndb::merge::${name}": - command => "pdbtool merge -r --glob \\*.pdb -D ${patterndb::config_dir}/${name} -p ${patterndb::temp_dir}/patterndb/${name}.xml", + command => "pdbtool merge -r --glob \\*.pdb -D ${patterndb::config_dir}/${name} -p ${patterndb::cache_dir}/patterndb/${name}.xml", path => $facts['path'], logoutput => true, refreshonly => true, } exec { "patterndb::test::${name}": - #command => "/usr/bin/pdbtool --validate test ${::patterndb::temp_dir}/patterndb/${name}.xml $modules", - command => "pdbtool test ${patterndb::temp_dir}/patterndb/${name}.xml ${modules}", + #command => "/usr/bin/pdbtool --validate test ${::patterndb::cache_dir}/patterndb/${name}.xml $modules", + command => "pdbtool test ${patterndb::cache_dir}/patterndb/${name}.xml ${modules}", path => $facts['path'], logoutput => true, refreshonly => true, } exec { "patterndb::deploy::${name}": - command => "cp ${patterndb::temp_dir}/patterndb/${name}.xml ${patterndb::base_dir}/var/lib/syslog-ng/patterndb/", + command => "cp ${patterndb::cache_dir}/patterndb/${name}.xml ${patterndb::base_dir}/var/lib/syslog-ng/patterndb/", logoutput => true, path => $facts['path'], refreshonly => true,