From a57ee0de2275a994f64ba36f09709f87dd0acbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Wed, 21 Oct 2015 07:18:20 +0000 Subject: [PATCH 1/3] Fix various warnings reported by puppet-lint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Include classes by absolute name for Puppet 4 compatibility - Single quote strigs which have no variables - Change ::syslog_ng::config::content define's default value into undef Signed-off-by: Samuli Seppänen --- manifests/config.pp | 2 +- manifests/init.pp | 2 +- manifests/reload.pp | 2 +- manifests/source.pp | 2 +- tests/config.pp | 2 +- tests/default_config.pp | 4 ++-- tests/destination.pp | 2 +- tests/filter.pp | 2 +- tests/init.pp | 2 +- tests/init_2.pp | 4 ++-- tests/log.pp | 2 +- tests/log_02.pp | 2 +- tests/options.pp | 4 ++-- tests/parser.pp | 2 +- tests/rewrite.pp | 2 +- tests/site.pp | 2 +- tests/source.pp | 2 +- tests/template.pp | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 5d9249e..6a166ba 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,5 +1,5 @@ define syslog_ng::config ( - $content = '', + $content = undef, $order = '5' ) { concat::fragment { "syslog_ng::config ${title}": diff --git a/manifests/init.pp b/manifests/init.pp index b119e25..7cedbf0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,7 +24,7 @@ validate_array($modules) validate_hash($init_config_hash) - class {'syslog_ng::reload': + class {'::syslog_ng::reload': syntax_check_before_reloads => $syntax_check_before_reloads } diff --git a/manifests/reload.pp b/manifests/reload.pp index a04f619..03209d3 100644 --- a/manifests/reload.pp +++ b/manifests/reload.pp @@ -2,7 +2,7 @@ $syntax_check_before_reloads = true ) { - include syslog_ng::params + include ::syslog_ng::params $config_file = $::syslog_ng::config_file $tmp_config_file = $::syslog_ng::params::tmp_config_file diff --git a/manifests/source.pp b/manifests/source.pp index bf1cbd5..1854f0c 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -1,7 +1,7 @@ define syslog_ng::source ( $params = [] ) { - include syslog_ng::params + include ::syslog_ng::params $type = 'source' $id = $title diff --git a/tests/config.pp b/tests/config.pp index c3a8188..18f2ee7 100644 --- a/tests/config.pp +++ b/tests/config.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::config {'version': content => '@version: 3.6', diff --git a/tests/default_config.pp b/tests/default_config.pp index 7bb2f71..473b957 100644 --- a/tests/default_config.pp +++ b/tests/default_config.pp @@ -1,6 +1,6 @@ class syslog_ng::default_config { - syslog_ng::config {"header comment": + syslog_ng::config {'header comment': content => ' # Default syslog-ng.conf file which collects all local logs into a # single file called /var/log/messages. @@ -38,7 +38,7 @@ { 'type' => 'file', 'options' => [ - "/var/log/messages" + '/var/log/messages' ] } } diff --git a/tests/destination.pp b/tests/destination.pp index 8e81052..497e06c 100644 --- a/tests/destination.pp +++ b/tests/destination.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::destination { 'd_udp': params => { diff --git a/tests/filter.pp b/tests/filter.pp index 784a276..f500aa1 100644 --- a/tests/filter.pp +++ b/tests/filter.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::filter {'f_tag_filter': params => { diff --git a/tests/init.pp b/tests/init.pp index 54d9e3d..aecb0f3 100644 --- a/tests/init.pp +++ b/tests/init.pp @@ -10,4 +10,4 @@ # http://docs.puppetlabs.com/guides/tests_smoke.html # -class { 'syslog_ng': } +class { '::syslog_ng': } diff --git a/tests/init_2.pp b/tests/init_2.pp index e466de7..d0fdc5d 100644 --- a/tests/init_2.pp +++ b/tests/init_2.pp @@ -10,7 +10,7 @@ # http://docs.puppetlabs.com/guides/tests_smoke.html # -class { 'syslog_ng': - tmp_config_file => '/tmp/syslog_ng_conf, +class { '::syslog_ng': + tmp_config_file => '/tmp/syslog_ng_conf', package_name => 'syslog-ng' } diff --git a/tests/log.pp b/tests/log.pp index 729e747..37c6c1b 100644 --- a/tests/log.pp +++ b/tests/log.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::log {'l': params => [ diff --git a/tests/log_02.pp b/tests/log_02.pp index 297e3e8..b3a7c02 100644 --- a/tests/log_02.pp +++ b/tests/log_02.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::log {'l2': params => [ diff --git a/tests/options.pp b/tests/options.pp index 5f1f31e..00d22b6 100644 --- a/tests/options.pp +++ b/tests/options.pp @@ -1,6 +1,6 @@ -include syslog_ng +include ::syslog_ng -syslog_ng::options { "global_options": +syslog_ng::options { 'global_options': options => { 'bad_hostname' => "'no'", 'time_reopen' => 10 diff --git a/tests/parser.pp b/tests/parser.pp index 4d13111..99af495 100644 --- a/tests/parser.pp +++ b/tests/parser.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::parser {'p_hostname_segmentation': params => { diff --git a/tests/rewrite.pp b/tests/rewrite.pp index ed634df..4f780a2 100644 --- a/tests/rewrite.pp +++ b/tests/rewrite.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::rewrite{'r_rewrite_subst': params => { diff --git a/tests/site.pp b/tests/site.pp index 865fd93..e45fe54 100644 --- a/tests/site.pp +++ b/tests/site.pp @@ -1,6 +1,6 @@ #import 'nodes.pp' -include syslog_ng +include ::syslog_ng # the header written by this module has order == 1, so the version must be 02 syslog_ng::config {'version': diff --git a/tests/source.pp b/tests/source.pp index d7974bf..5a1aff6 100644 --- a/tests/source.pp +++ b/tests/source.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::source { 's_gsoc': params => { diff --git a/tests/template.pp b/tests/template.pp index 177b38c..fa70afd 100644 --- a/tests/template.pp +++ b/tests/template.pp @@ -1,4 +1,4 @@ -include syslog_ng +include ::syslog_ng syslog_ng::template {'t_demo_filetemplate': params => [ From 14157f9a90a3c1e56c37e1eed269af0308ffefd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Wed, 21 Oct 2015 07:28:30 +0000 Subject: [PATCH 2/3] Replace mixed tabs and spaces in tests/site.pp with spaces only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Samuli Seppänen --- tests/site.pp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/site.pp b/tests/site.pp index e45fe54..8db6ef3 100644 --- a/tests/site.pp +++ b/tests/site.pp @@ -9,19 +9,19 @@ } syslog_ng::options { 'global_options': - options => { - 'bad_hostname' => "'no'" - } + options => { + 'bad_hostname' => "'no'" + } } syslog_ng::source { 's_gsoc': - params => { - 'type' => 'tcp', - 'options' => { - 'ip' => "'127.0.0.1'", - 'port' => 1999 - } - } + params => { + 'type' => 'tcp', + 'options' => { + 'ip' => "'127.0.0.1'", + 'port' => 1999 + } + } } syslog_ng::source {'s_external': From cb1352d2e59eaa9e6db0af5d5bf245d677703eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Wed, 21 Oct 2015 12:02:37 +0000 Subject: [PATCH 3/3] Add $::syslog_ng::params::config_dir parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use of this parameter avoids the need to hardcode the syslog-ng config directory path into external modules. Signed-off-by: Samuli Seppänen --- manifests/params.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index c613faa..545f8cc 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -33,6 +33,7 @@ } $service_name = 'syslog-ng' $tmp_config_file = '/tmp/syslog-ng.conf.tmp' - $config_file = '/etc/syslog-ng/syslog-ng.conf' + $config_dir = '/etc/syslog-ng' + $config_file = "${config_dir}/syslog-ng.conf" $config_file_header = "# This file was generated by Puppet's ihrwein-syslog_ng module" }