From c85d57dc9cf8a3dcc0f7c54abccfc66360d1c15f Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Tue, 3 Jan 2017 17:47:36 +0100 Subject: [PATCH 1/3] Make Puppet Lint happy --- Rakefile | 14 ++++++++++++- manifests/config/fragment.pp | 12 ++++++------ manifests/feature/api.pp | 18 ++++++++--------- manifests/feature/checker.pp | 2 +- manifests/feature/command.pp | 6 +++--- manifests/feature/compatlog.pp | 6 +++--- manifests/feature/debuglog.pp | 4 ++-- manifests/feature/gelf.pp | 2 +- manifests/feature/graphite.pp | 2 +- manifests/feature/idomysql.pp | 14 ++++++------- manifests/feature/idopgsql.pp | 4 ++-- manifests/feature/influxdb.pp | 16 +++++++-------- manifests/feature/livestatus.pp | 6 +++--- manifests/feature/mainlog.pp | 4 ++-- manifests/feature/notification.pp | 2 +- manifests/feature/opentsdb.pp | 2 +- manifests/feature/perfdata.pp | 6 +++--- manifests/feature/statusdata.pp | 6 +++--- manifests/feature/syslog.pp | 2 +- manifests/init.pp | 2 +- manifests/object.pp | 14 ++++++------- manifests/object/apiuser.pp | 4 ++-- manifests/object/checkcommand.pp | 2 +- manifests/object/checkresultreader.pp | 2 +- manifests/object/compatlogger.pp | 2 +- manifests/object/dependency.pp | 4 ++-- manifests/object/eventcommand.pp | 2 +- manifests/object/host.pp | 2 +- manifests/object/hostgroup.pp | 2 +- manifests/object/notification.pp | 4 ++-- manifests/object/notificationcommand.pp | 2 +- manifests/object/scheduleddowntime.pp | 6 +++--- manifests/object/service.pp | 2 +- manifests/object/servicegroup.pp | 2 +- manifests/object/timeperiod.pp | 2 +- manifests/object/user.pp | 2 +- manifests/object/usergroup.pp | 2 +- manifests/params.pp | 8 ++++---- manifests/pki/ca.pp | 26 ++++++++++++------------- manifests/repo.pp | 16 +++++++-------- 40 files changed, 124 insertions(+), 112 deletions(-) diff --git a/Rakefile b/Rakefile index 0f710fd20..f3a2876b2 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,15 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] +PuppetLint.configuration.send('disable_selector_inside_resource') +PuppetLint.configuration.send('disable_only_variable_string') +PuppetLint.configuration.ignore_paths = [ + "spec/**/*.pp", + "serverspec/**/*.pp", + "pkg/**/*.pp", + "examples/**/*.pp", + "vendor/**/*.pp" +] desc "Validate manifests, templates, and ruby files" task :validate do @@ -17,3 +25,7 @@ task :validate do sh "erb -P -x -T '-' #{template} | ruby -c" end end + +#PuppetLint::RakeTask.new :lint do |config| +# config.pattern = 'manifests/*/**.pp' +#end diff --git a/manifests/config/fragment.pp b/manifests/config/fragment.pp index d35ef0443..e657ef40a 100644 --- a/manifests/config/fragment.pp +++ b/manifests/config/fragment.pp @@ -19,10 +19,10 @@ # Icinga Development Team # define icinga2::config::fragment( - $code_name = $title, - $order = '0', $content, $target, + $code_name = $title, + $order = '0', ) { include ::icinga2::params @@ -58,13 +58,13 @@ } concat::fragment { "icinga2::config::${code_name}": - target => $target, - content => $::osfamily ? { + target => $target, + content => $::osfamily ? { 'windows' => regsubst($content, '\n', "\r\n", 'EMG'), default => $content, }, - order => $order, - notify => Class['::icinga2::service'], + order => $order, + notify => Class['::icinga2::service'], } } diff --git a/manifests/feature/api.pp b/manifests/feature/api.pp index 0091662af..29171e6cb 100644 --- a/manifests/feature/api.pp +++ b/manifests/feature/api.pp @@ -215,12 +215,12 @@ 'none': { if $ssl_key { file { $_ssl_key_path: - ensure => file, - mode => $::kernel ? { + ensure => file, + mode => $::kernel ? { 'windows' => undef, default => '0600', }, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_key, '\n', "\r\n", 'EMG'), default => $ssl_key, }, @@ -231,7 +231,7 @@ if $ssl_cert { file { $_ssl_cert_path: ensure => file, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_cert, '\n', "\r\n", 'EMG'), default => $ssl_cert, }, @@ -242,7 +242,7 @@ if $ssl_cacert { file { $_ssl_cacert_path: ensure => file, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_cacert, '\n', "\r\n", 'EMG'), default => $ssl_cacert, }, @@ -268,20 +268,20 @@ mode => '0600'; $_ssl_cert_path: } -> - + exec { 'icinga2 pki get trusted-cert': command => "icinga2 pki save-cert --host '${ca_host}' --port ${ca_port} --key '${_ssl_key_path}' --cert '${_ssl_cert_path}' --trustedcert '${trusted_cert}'", creates => $trusted_cert, notify => Class['::icinga2::service'], } -> file { $trusted_cert: } -> - + exec { 'icinga2 pki request': command => "icinga2 pki request --host '${ca_host}' --port ${ca_port} --ca '${_ssl_cacert_path}' --key '${_ssl_key_path}' --cert '${_ssl_cert_path}' --trustedcert '${trusted_cert}' --ticket '${ticket_id}'", creates => $_ssl_cacert_path, notify => Class['::icinga2::service'], } -> - file { $_ssl_cacert_path: } + file { $_ssl_cacert_path: } } # icinga2 } # pki @@ -300,7 +300,7 @@ create_resources('icinga2::object::zone', $zones) # create object - icinga2::object { "icinga2::object::ApiListener::api": + icinga2::object { 'icinga2::object::ApiListener::api': object_name => 'api', object_type => 'ApiListener', attrs => $attrs, diff --git a/manifests/feature/checker.pp b/manifests/feature/checker.pp index 6a4e9c63e..09ff3fff5 100644 --- a/manifests/feature/checker.pp +++ b/manifests/feature/checker.pp @@ -24,7 +24,7 @@ "${ensure} isn't supported. Valid values are 'present' and 'absent'.") # create object - icinga2::object { "icinga2::object::CheckerComponent::checker": + icinga2::object { 'icinga2::object::CheckerComponent::checker': object_name => 'checker', object_type => 'CheckerComponent', attrs => {}, diff --git a/manifests/feature/command.pp b/manifests/feature/command.pp index 4ee73912a..080a6bcd8 100644 --- a/manifests/feature/command.pp +++ b/manifests/feature/command.pp @@ -30,11 +30,11 @@ } # create object - icinga2::object { "icinga2::object::ExternalCommandListener::command": + icinga2::object { 'icinga2::object::ExternalCommandListener::command': object_name => 'command', object_type => 'ExternalCommandListener', attrs => $attrs, - target => "${conf_dir}/features-available/command.conf", + target => "${::conf_dir}/features-available/command.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -44,7 +44,7 @@ # import library 'compat' concat::fragment { 'icinga2::feature::command': - target => "${conf_dir}/features-available/command.conf", + target => "${::conf_dir}/features-available/command.conf", content => "library \"compat\"\n\n", order => '05', } diff --git a/manifests/feature/compatlog.pp b/manifests/feature/compatlog.pp index a93093098..6d8bf9afd 100644 --- a/manifests/feature/compatlog.pp +++ b/manifests/feature/compatlog.pp @@ -38,11 +38,11 @@ } # create object - icinga2::object { "icinga2::object::CompatLogger::compatlog": + icinga2::object { 'icinga2::object::CompatLogger::compatlog': object_name => 'compatlog', object_type => 'CompatLogger', attrs => $attrs, - target => "${conf_dir}/features-available/compatlog.conf", + target => "${::conf_dir}/features-available/compatlog.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -52,7 +52,7 @@ # import library 'compat' concat::fragment { 'icinga2::feature::compatlog': - target => "${conf_dir}/features-available/compatlog.conf", + target => "${::conf_dir}/features-available/compatlog.conf", content => "library \"compat\"\n\n", order => '05', } diff --git a/manifests/feature/debuglog.pp b/manifests/feature/debuglog.pp index 984bb911c..f689f238a 100644 --- a/manifests/feature/debuglog.pp +++ b/manifests/feature/debuglog.pp @@ -33,11 +33,11 @@ } # create object - icinga2::object { "icinga2::object::FileLogger::debuglog": + icinga2::object { 'icinga2::object::FileLogger::debuglog': object_name => 'debug-file', object_type => 'FileLogger', attrs => $attrs, - target => "${conf_dir}/features-available/debuglog.conf", + target => "${::conf_dir}/features-available/debuglog.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], diff --git a/manifests/feature/gelf.pp b/manifests/feature/gelf.pp index d3e0564ba..0bdc8e8a7 100644 --- a/manifests/feature/gelf.pp +++ b/manifests/feature/gelf.pp @@ -52,7 +52,7 @@ } # create object - icinga2::object { "icinga2::object::GelfWriter::gelf": + icinga2::object { 'icinga2::object::GelfWriter::gelf': object_name => 'gelf', object_type => 'GelfWriter', attrs => $attrs, diff --git a/manifests/feature/graphite.pp b/manifests/feature/graphite.pp index 92b267c0d..5d00f5121 100644 --- a/manifests/feature/graphite.pp +++ b/manifests/feature/graphite.pp @@ -64,7 +64,7 @@ } # create object - icinga2::object { "icinga2::object::GraphiteWriter::graphite": + icinga2::object { 'icinga2::object::GraphiteWriter::graphite': object_name => 'graphite', object_type => 'GraphiteWriter', attrs => $attrs, diff --git a/manifests/feature/idomysql.pp b/manifests/feature/idomysql.pp index 2d618fca7..6f71b5e8b 100644 --- a/manifests/feature/idomysql.pp +++ b/manifests/feature/idomysql.pp @@ -250,12 +250,12 @@ 'none': { if $ssl_key { file { $_ssl_key_path: - ensure => file, - mode => $::kernel ? { + ensure => file, + mode => $::kernel ? { 'windows' => undef, default => '0600', }, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_key, '\n', "\r\n", 'EMG'), default => $ssl_key, }, @@ -266,7 +266,7 @@ if $ssl_cert { file { $_ssl_cert_path: ensure => file, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_cert, '\n', "\r\n", 'EMG'), default => $ssl_cert, }, @@ -277,7 +277,7 @@ if $ssl_cacert { file { $_ssl_cacert_path: ensure => file, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_cacert, '\n', "\r\n", 'EMG'), default => $ssl_cacert, }, @@ -323,7 +323,7 @@ } # create object - icinga2::object { "icinga2::object::IdoMysqlConnection::ido-mysql": + icinga2::object { 'icinga2::object::IdoMysqlConnection::ido-mysql': object_name => 'ido-mysql', object_type => 'IdoMysqlConnection', attrs => merge($attrs, $attrs_ssl), @@ -343,7 +343,7 @@ } icinga2::feature { 'ido-mysql': - ensure => $ensure, + ensure => $ensure, require => Package['icinga2-ido-mysql'] } } diff --git a/manifests/feature/idopgsql.pp b/manifests/feature/idopgsql.pp index 77e5ce056..680babb2b 100644 --- a/manifests/feature/idopgsql.pp +++ b/manifests/feature/idopgsql.pp @@ -141,7 +141,7 @@ } # create object - icinga2::object { "icinga2::object::IdoPgsqlConnection::ido-pgsql": + icinga2::object { 'icinga2::object::IdoPgsqlConnection::ido-pgsql': object_name => 'ido-pgsql', object_type => 'IdoPgsqlConnection', attrs => $attrs, @@ -161,7 +161,7 @@ } icinga2::feature { 'ido-pgsql': - ensure => $ensure, + ensure => $ensure, require => Package['icinga2-ido-pgsql'] } } diff --git a/manifests/feature/influxdb.pp b/manifests/feature/influxdb.pp index 066297a89..3930cd76a 100644 --- a/manifests/feature/influxdb.pp +++ b/manifests/feature/influxdb.pp @@ -151,8 +151,8 @@ $conf_dir = $::icinga2::params::conf_dir $ssl_dir = "${::icinga2::params::pki_dir}/influxdb" - $host_template = { measurement => "$host_measurement", tags => $host_tags } - $service_template = { measurement => "$service_measurement", tags => $service_tags} + $host_template = { measurement => "${host_measurement}", tags => $host_tags } + $service_template = { measurement => "${service_measurement}", tags => $service_tags} File { owner => $user, @@ -216,12 +216,12 @@ 'none': { if $ssl_key { file { $_ssl_key_path: - ensure => file, - mode => $::kernel ? { + ensure => file, + mode => $::kernel ? { 'windows' => undef, default => '0600', }, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_key, '\n', "\r\n", 'EMG'), default => $ssl_key, }, @@ -232,7 +232,7 @@ if $ssl_cert { file { $_ssl_cert_path: ensure => file, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_cert, '\n', "\r\n", 'EMG'), default => $ssl_cert, }, @@ -243,7 +243,7 @@ if $ssl_cacert { file { $_ssl_cacert_path: ensure => file, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ssl_cacert, '\n', "\r\n", 'EMG'), default => $ssl_cacert, }, @@ -272,7 +272,7 @@ } # create object - icinga2::object { "icinga2::object::InfluxdbWriter::influxdb": + icinga2::object { 'icinga2::object::InfluxdbWriter::influxdb': object_name => 'influxdb', object_type => 'InfluxdbWriter', attrs => merge($attrs, $attrs_ssl), diff --git a/manifests/feature/livestatus.pp b/manifests/feature/livestatus.pp index 137f45af0..58329152b 100644 --- a/manifests/feature/livestatus.pp +++ b/manifests/feature/livestatus.pp @@ -62,11 +62,11 @@ } # create object - icinga2::object { "icinga2::object::LivestatusListener::livestatus": + icinga2::object { 'icinga2::object::LivestatusListener::livestatus': object_name => 'livestatus', object_type => 'LivestatusListener', attrs => $attrs, - target => "${conf_dir}/features-available/livestatus.conf", + target => "${::conf_dir}/features-available/livestatus.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -76,7 +76,7 @@ # import library 'livestatus' concat::fragment { 'icinga2::feature::livestatus': - target => "${conf_dir}/features-available/livestatus.conf", + target => "${::conf_dir}/features-available/livestatus.conf", content => "library \"livestatus\"\n\n", order => '05', } diff --git a/manifests/feature/mainlog.pp b/manifests/feature/mainlog.pp index 13bb4dd07..9fa78872a 100644 --- a/manifests/feature/mainlog.pp +++ b/manifests/feature/mainlog.pp @@ -37,11 +37,11 @@ } # create object - icinga2::object { "icinga2::object::FileLogger::mainlog": + icinga2::object { 'icinga2::object::FileLogger::mainlog': object_name => 'main-log', object_type => 'FileLogger', attrs => $attrs, - target => "${conf_dir}/features-available/mainlog.conf", + target => "${::conf_dir}/features-available/mainlog.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], diff --git a/manifests/feature/notification.pp b/manifests/feature/notification.pp index ebec229ad..c7ab587e4 100644 --- a/manifests/feature/notification.pp +++ b/manifests/feature/notification.pp @@ -24,7 +24,7 @@ "${ensure} isn't supported. Valid values are 'present' and 'absent'.") # create object - icinga2::object { "icinga2::object::NotificationComponent::notification": + icinga2::object { 'icinga2::object::NotificationComponent::notification': object_name => 'notification', object_type => 'NotificationComponent', attrs => {}, diff --git a/manifests/feature/opentsdb.pp b/manifests/feature/opentsdb.pp index c75caa8bc..25bd875f5 100644 --- a/manifests/feature/opentsdb.pp +++ b/manifests/feature/opentsdb.pp @@ -40,7 +40,7 @@ } # create object - icinga2::object { "icinga2::object::OpenTsdbWriter::opentsdb": + icinga2::object { 'icinga2::object::OpenTsdbWriter::opentsdb': object_name => 'opentsdb', object_type => 'OpenTsdbWriter', attrs => $attrs, diff --git a/manifests/feature/perfdata.pp b/manifests/feature/perfdata.pp index 979366a7c..51870ceed 100644 --- a/manifests/feature/perfdata.pp +++ b/manifests/feature/perfdata.pp @@ -79,11 +79,11 @@ } # create object - icinga2::object { "icinga2::object::PerfdataWriter::perfdata": + icinga2::object { 'icinga2::object::PerfdataWriter::perfdata': object_name => 'perfdata', object_type => 'PerfdataWriter', attrs => $attrs, - target => "${conf_dir}/features-available/perfdata.conf", + target => "${::conf_dir}/features-available/perfdata.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -93,7 +93,7 @@ # import library 'perfdata' concat::fragment { 'icinga2::feature::perfdata': - target => "${conf_dir}/features-available/perfdata.conf", + target => "${::conf_dir}/features-available/perfdata.conf", content => "library \"perfdata\"\n\n", order => '05', } diff --git a/manifests/feature/statusdata.pp b/manifests/feature/statusdata.pp index 0b15092d2..34eb09633 100644 --- a/manifests/feature/statusdata.pp +++ b/manifests/feature/statusdata.pp @@ -47,11 +47,11 @@ } # create object - icinga2::object { "icinga2::object::StatusDataWriter::statusdata": + icinga2::object { 'icinga2::object::StatusDataWriter::statusdata': object_name => 'statusdata', object_type => 'StatusDataWriter', attrs => $attrs, - target => "${conf_dir}/features-available/statusdata.conf", + target => "${::conf_dir}/features-available/statusdata.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -61,7 +61,7 @@ # import library 'compat' concat::fragment { 'icinga2::feature::statusdata': - target => "${conf_dir}/features-available/statusdata.conf", + target => "${::conf_dir}/features-available/statusdata.conf", content => "library \"compat\"\n\n", order => '05', } diff --git a/manifests/feature/syslog.pp b/manifests/feature/syslog.pp index be8066530..ed8820ebb 100644 --- a/manifests/feature/syslog.pp +++ b/manifests/feature/syslog.pp @@ -35,7 +35,7 @@ } # create object - icinga2::object { "icinga2::object::SyslogLogger::syslog": + icinga2::object { 'icinga2::object::SyslogLogger::syslog': object_name => 'syslog', object_type => 'SyslogLogger', attrs => $attrs, diff --git a/manifests/init.pp b/manifests/init.pp index 1a064abeb..644f585fc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -148,7 +148,7 @@ # validate confd, boolean or string if is_bool($confd) { - if $confd { $_confd = "conf.d" } else { $_confd = undef } + if $confd { $_confd = 'conf.d' } else { $_confd = undef } } elsif is_string($confd) { $_confd = $confd } else { diff --git a/manifests/object.pp b/manifests/object.pp index ded583331..cf0163abc 100644 --- a/manifests/object.pp +++ b/manifests/object.pp @@ -49,6 +49,9 @@ # Icinga Development Team # define icinga2::object( + $object_type, + $target, + $order, $ensure = present, $object_name = $title, $template = false, @@ -58,9 +61,6 @@ $assign = [], $ignore = [], $attrs = {}, - $object_type, - $target, - $order, ) { if defined($caller_module_name) and $module_name != $caller_module_name { @@ -93,7 +93,7 @@ validate_bool($template) unless is_bool($apply) { validate_re($apply, '^.+\s+(=>\s+.+\s+)?in\s+.+$') } if $apply_target { validate_re($apply_target, ['^Host$', '^Service$'], - "$apply_target isn't supported. Valid values are 'Host' and 'Service'.") } + "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") } validate_array($import) validate_array($assign) validate_array($ignore) @@ -103,7 +103,7 @@ validate_string($order) if $object_type == $apply_target { - fail("The object type must be different from the apply target") + fail('The object type must be different from the apply target') } $_attrs = merge($attrs, { @@ -121,8 +121,8 @@ if $ensure != 'absent' { concat::fragment { $title: - target => $target, - content => $::osfamily ? { + target => $target, + content => $::osfamily ? { 'windows' => regsubst(template('icinga2/object.conf.erb'), '\n', "\r\n", 'EMG'), default => template('icinga2/object.conf.erb'), }, diff --git a/manifests/object/apiuser.pp b/manifests/object/apiuser.pp index ceadb345b..cb111cbf0 100644 --- a/manifests/object/apiuser.pp +++ b/manifests/object/apiuser.pp @@ -49,13 +49,13 @@ # Icinga Development Team # define icinga2::object::apiuser( + $target, + $permissions, $ensure = present, $apiuser_name = $title, $password = undef, $client_cn = undef, $order = '30', - $target, - $permissions, ) { include ::icinga2::params diff --git a/manifests/object/checkcommand.pp b/manifests/object/checkcommand.pp index 4b50cce37..c0ccb032a 100644 --- a/manifests/object/checkcommand.pp +++ b/manifests/object/checkcommand.pp @@ -42,6 +42,7 @@ # Icinga Development Team # define icinga2::object::checkcommand( + $target, $ensure = present, $checkcommand_name = $title, $import = ['plugin-check-command'], @@ -52,7 +53,6 @@ $arguments = undef, $template = false, $order = '15', - $target, ) { include ::icinga2::params diff --git a/manifests/object/checkresultreader.pp b/manifests/object/checkresultreader.pp index c39a29c74..70ba650c7 100644 --- a/manifests/object/checkresultreader.pp +++ b/manifests/object/checkresultreader.pp @@ -25,11 +25,11 @@ # Icinga Development Team # define icinga2::object::checkresultreader ( + $target, $ensure = present, $checkresultreader_name = $title, $spool_dir = undef, $order = '10', - $target, ){ include ::icinga2::params diff --git a/manifests/object/compatlogger.pp b/manifests/object/compatlogger.pp index ec7ca91c6..37a743acf 100644 --- a/manifests/object/compatlogger.pp +++ b/manifests/object/compatlogger.pp @@ -25,12 +25,12 @@ # Icinga Development Team # define icinga2::object::compatlogger ( + $target, $ensure = present, $compatlogger_name = $title, $log_dir = undef, $rotation_method = undef, $order = '5', - $target, ){ include ::icinga2::params diff --git a/manifests/object/dependency.pp b/manifests/object/dependency.pp index 04dfa9a02..b38766331 100644 --- a/manifests/object/dependency.pp +++ b/manifests/object/dependency.pp @@ -75,6 +75,7 @@ # Icinga Development Team # define icinga2::object::dependency ( + $target, $ensure = present, $dependency_name = $title, $parent_host_name = undef, @@ -93,7 +94,6 @@ $import = [], $template = false, $order = '70', - $target, ){ include ::icinga2::params @@ -105,7 +105,7 @@ validate_string($dependency_name) unless is_bool($apply) { validate_string($apply) } validate_re($apply_target, ['^Host$', '^Service$'], - "$apply_target isn't supported. Valid values are 'Host' and 'Service'.") + "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") validate_array($import) validate_bool($template) validate_absolute_path($target) diff --git a/manifests/object/eventcommand.pp b/manifests/object/eventcommand.pp index 4ed0573b3..e47e55029 100644 --- a/manifests/object/eventcommand.pp +++ b/manifests/object/eventcommand.pp @@ -46,6 +46,7 @@ # Icinga Development Team # define icinga2::object::eventcommand ( + $target, $ensure = present, $eventcommand_name = $title, $command = undef, @@ -55,7 +56,6 @@ $arguments = undef, $import = ['plugin-event-command'], $order = '20', - $target, ){ include ::icinga2::params diff --git a/manifests/object/host.pp b/manifests/object/host.pp index 3daf5df76..2a8d6c137 100644 --- a/manifests/object/host.pp +++ b/manifests/object/host.pp @@ -110,6 +110,7 @@ # Icinga Development Team # define icinga2::object::host( + $target, $ensure = present, $host_name = $title, $import = [], @@ -142,7 +143,6 @@ $icon_image_alt = undef, $template = false, $order = '50', - $target, ) { include ::icinga2::params diff --git a/manifests/object/hostgroup.pp b/manifests/object/hostgroup.pp index 7fa436278..20fecae63 100644 --- a/manifests/object/hostgroup.pp +++ b/manifests/object/hostgroup.pp @@ -37,6 +37,7 @@ # Icinga Development Team # define icinga2::object::hostgroup( + $target, $ensure = present, $hostgroup_name = $title, $display_name = undef, @@ -44,7 +45,6 @@ $assign = [], $ignore = [], $order = '55', - $target, ) { # validation diff --git a/manifests/object/notification.pp b/manifests/object/notification.pp index b7319ce3c..34f0923f5 100644 --- a/manifests/object/notification.pp +++ b/manifests/object/notification.pp @@ -80,6 +80,7 @@ # Icinga Development Team # define icinga2::object::notification ( + $target, $ensure = present, $notification_name = $title, $host_name = undef, @@ -101,7 +102,6 @@ $import = [], $template = false, $order = '85', - $target, ){ include ::icinga2::params @@ -113,7 +113,7 @@ validate_string($notification_name) unless is_bool($apply) { validate_string($apply) } validate_re($apply_target, ['^Host$', '^Service$'], - "$apply_target isn't supported. Valid values are 'Host' and 'Service'.") + "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") validate_array($import) validate_bool($template) validate_absolute_path($target) diff --git a/manifests/object/notificationcommand.pp b/manifests/object/notificationcommand.pp index 2cd0217eb..abea2f9f4 100644 --- a/manifests/object/notificationcommand.pp +++ b/manifests/object/notificationcommand.pp @@ -52,6 +52,7 @@ # Icinga Development Team # define icinga2::object::notificationcommand ( + $target, $ensure = present, $notificationcommand_name = $title, $command = undef, @@ -62,7 +63,6 @@ $template = false, $import = ['plugin-notification-command'], $order = '25', - $target, ){ include ::icinga2::params diff --git a/manifests/object/scheduleddowntime.pp b/manifests/object/scheduleddowntime.pp index 50fbac1d2..c20631bc3 100644 --- a/manifests/object/scheduleddowntime.pp +++ b/manifests/object/scheduleddowntime.pp @@ -56,6 +56,7 @@ # Icinga Development Team # define icinga2::object::scheduleddowntime ( + $target, $ensure = present, $scheduleddowntime_name = $title, $host_name = undef, @@ -70,7 +71,6 @@ $assign = [], $ignore = [], $order = '90', - $target, ){ include ::icinga2::params @@ -82,7 +82,7 @@ validate_string($scheduleddowntime_name) unless is_bool($apply) { validate_string($apply) } validate_re($apply_target, ['^Host$', '^Service$'], - "$apply_target isn't supported. Valid values are 'Host' and 'Service'.") + "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") validate_absolute_path($target) validate_string($order) @@ -117,7 +117,7 @@ ignore => $ignore, target => $target, order => $order, - notify => Class['::icinga2::service'], + notify => Class['::icinga2::service'], } } diff --git a/manifests/object/service.pp b/manifests/object/service.pp index 1b7c0ef79..7d18b6d94 100644 --- a/manifests/object/service.pp +++ b/manifests/object/service.pp @@ -131,6 +131,7 @@ # define icinga2::object::service ( + $target, $ensure = present, $service_name = $title, $display_name = undef, @@ -165,7 +166,6 @@ $import = [], $template = false, $order = '60', - $target, ) { include ::icinga2::params diff --git a/manifests/object/servicegroup.pp b/manifests/object/servicegroup.pp index 66fdf5806..8306c5f75 100644 --- a/manifests/object/servicegroup.pp +++ b/manifests/object/servicegroup.pp @@ -41,6 +41,7 @@ # Icinga Development Team # define icinga2::object::servicegroup ( + $target, $ensure = present, $servicegroup_name = $title, $display_name = undef, @@ -50,7 +51,6 @@ $template = false, $import = [], $order = '65', - $target, ){ include ::icinga2::params diff --git a/manifests/object/timeperiod.pp b/manifests/object/timeperiod.pp index febe2b6b9..4552fa0b8 100644 --- a/manifests/object/timeperiod.pp +++ b/manifests/object/timeperiod.pp @@ -44,6 +44,7 @@ # Icinga Development Team # define icinga2::object::timeperiod ( + $target, $ensure = present, $timeperiod_name = $title, $display_name = undef, @@ -54,7 +55,6 @@ $template = false, $import = ['legacy-timeperiod'], $order = '35', - $target, ){ include ::icinga2::params diff --git a/manifests/object/user.pp b/manifests/object/user.pp index 2e21678eb..28ae71743 100644 --- a/manifests/object/user.pp +++ b/manifests/object/user.pp @@ -59,6 +59,7 @@ # Icinga Development Team # define icinga2::object::user ( + $target, $ensure = present, $user_name = $title, $display_name = undef, @@ -73,7 +74,6 @@ $import = [], $template = false, $order = '75', - $target, ){ include ::icinga2::params diff --git a/manifests/object/usergroup.pp b/manifests/object/usergroup.pp index d63ef9bde..82f7991c3 100644 --- a/manifests/object/usergroup.pp +++ b/manifests/object/usergroup.pp @@ -41,6 +41,7 @@ # Icinga Development Team # define icinga2::object::usergroup ( + $target, $ensure = present, $usergroup_name = $title, $display_name = undef, @@ -50,7 +51,6 @@ $import = [], $template = false, $order = '80', - $target, ){ include ::icinga2::params diff --git a/manifests/params.pp b/manifests/params.pp index 1c6d2e73b..4a8873919 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -93,7 +93,7 @@ $spool_dir = '/var/spool/icinga2' $cache_dir = '/var/cache/icinga2' $pki_dir = "${conf_dir}/pki" - $ca_dir = "/var/lib/icinga2/ca" + $ca_dir = '/var/lib/icinga2/ca' case $::osfamily { 'redhat': { @@ -146,9 +146,9 @@ $pki_dir = "${conf_dir}/pki" $ca_dir = 'C:/ProgramData/icinga2/var/lib/icinga2/ca' $constants = { - 'PluginDir' => "C:/Program Files/ICINGA2/sbin", - 'PluginContribDir' => "C:/Program Files/ICINGA2/sbin", - 'ManubulonPluginDir' => "C:/Program Files/ICINGA2/sbin", + 'PluginDir' => 'C:/Program Files/ICINGA2/sbin', + 'PluginContribDir' => 'C:/Program Files/ICINGA2/sbin', + 'ManubulonPluginDir' => 'C:/Program Files/ICINGA2/sbin', 'ZoneName' => $::fqdn, 'NodeName' => $::fqdn, 'TicketSalt' => '', diff --git a/manifests/pki/ca.pp b/manifests/pki/ca.pp index d00ddb3a3..6511735cd 100644 --- a/manifests/pki/ca.pp +++ b/manifests/pki/ca.pp @@ -48,14 +48,14 @@ group => $group, } - if ! $ca_cert orĀ ! $ca_key { + if !$ca_cert or !$ca_key { exec { 'create-icinga2-ca': path => $::osfamily ? { 'windows' => 'C:/ProgramFiles/ICINGA2/sbin', default => '/bin:/usr/bin:/sbin:/usr/sbin', }, command => 'icinga2 pki new-ca', - creates => "$ca_dir/ca.crt", + creates => "${ca_dir}/ca.crt", notify => Class['::icinga2::service'], } } else { @@ -70,27 +70,27 @@ default => '0700', } } - - file { "$ca_dir/ca.crt": - ensure => file, - content => $::osfamily ? { + + file { "${ca_dir}/ca.crt": + ensure => file, + content => $::osfamily ? { 'windows' => regsubst($ca_cert, '\n', "\r\n", 'EMG'), default => $ca_cert, }, - tag => 'icinga2::config::file', + tag => 'icinga2::config::file', } - - file { "$ca_dir/ca.key": - ensure => file, - mode => $::kernel ? { + + file { "${ca_dir}/ca.key": + ensure => file, + mode => $::kernel ? { 'windows' => undef, default => '0600', }, - content => $::osfamily ? { + content => $::osfamily ? { 'windows' => regsubst($ca_key, '\n', "\r\n", 'EMG'), default => $ca_key, }, - tag => 'icinga2::config::file', + tag => 'icinga2::config::file', } } } diff --git a/manifests/repo.pp b/manifests/repo.pp index 773e45b81..cf661ce41 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -69,19 +69,19 @@ default: { fail('Your plattform is not supported to manage a repository.') } - } + } contain ::apt::update } 'suse': { - + file { '/etc/pki/GPG-KEY-icinga': ensure => present, source => 'http://packages.icinga.com/icinga.key', } - exec { "import icinga gpg key": + exec { 'import icinga gpg key': path => '/bin:/usr/bin:/sbin:/usr/sbin', - command => "rpm --import /etc/pki/GPG-KEY-icinga", + command => 'rpm --import /etc/pki/GPG-KEY-icinga', unless => "rpm -q gpg-pubkey-`echo $(gpg --throw-keyids < /etc/pki/GPG-KEY-icinga) | cut --characters=11-18 | tr [A-Z] [a-z]`", require => File['/etc/pki/GPG-KEY-icinga'], logoutput => 'on_failure', @@ -90,10 +90,10 @@ case $::operatingsystem { 'SLES': { zypprepo { 'icinga-stable-release': - baseurl => "http://packages.icinga.com/SUSE/${::operatingsystemrelease}/release/", - enabled => 1, - gpgcheck => 1, - require => Exec['import icinga gpg key'] + baseurl => "http://packages.icinga.com/SUSE/${::operatingsystemrelease}/release/", + enabled => 1, + gpgcheck => 1, + require => Exec['import icinga gpg key'] } } default: { From 86205597038bd090842f09150a09c1a2930db38f Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Wed, 4 Jan 2017 09:42:14 +0100 Subject: [PATCH 2/3] Unify usage of in features --- manifests/feature/api.pp | 2 -- manifests/feature/checker.pp | 2 -- manifests/feature/command.pp | 8 +++++--- manifests/feature/compatlog.pp | 8 +++++--- manifests/feature/debuglog.pp | 6 ++++-- manifests/feature/gelf.pp | 2 -- manifests/feature/graphite.pp | 2 -- manifests/feature/idomysql.pp | 26 +++++++++++--------------- manifests/feature/idopgsql.pp | 4 ++-- manifests/feature/influxdb.pp | 22 ++++++++++------------ manifests/feature/livestatus.pp | 8 +++++--- manifests/feature/mainlog.pp | 6 ++++-- manifests/feature/notification.pp | 4 +--- manifests/feature/opentsdb.pp | 4 +--- manifests/feature/perfdata.pp | 8 +++++--- manifests/feature/statusdata.pp | 8 +++++--- manifests/feature/syslog.pp | 4 +--- 17 files changed, 59 insertions(+), 65 deletions(-) diff --git a/manifests/feature/api.pp b/manifests/feature/api.pp index 29171e6cb..317ca41f1 100644 --- a/manifests/feature/api.pp +++ b/manifests/feature/api.pp @@ -140,8 +140,6 @@ $ssl_cacert = undef, ) { - include ::icinga2::params - $conf_dir = $::icinga2::params::conf_dir $pki_dir = $::icinga2::params::pki_dir $user = $::icinga2::params::user diff --git a/manifests/feature/checker.pp b/manifests/feature/checker.pp index 09ff3fff5..5cff68e10 100644 --- a/manifests/feature/checker.pp +++ b/manifests/feature/checker.pp @@ -15,8 +15,6 @@ $ensure = present, ) { - include ::icinga2::params - $conf_dir = $::icinga2::params::conf_dir # validation diff --git a/manifests/feature/command.pp b/manifests/feature/command.pp index 080a6bcd8..f6b9d17e4 100644 --- a/manifests/feature/command.pp +++ b/manifests/feature/command.pp @@ -18,7 +18,9 @@ class icinga2::feature::command( $ensure = present, $command_path = "${::icinga2::params::run_dir}/cmd/icinga2.cmd", -) inherits icinga2::params { +) { + + $conf_dir = $::icinga2::params::conf_dir validate_re($ensure, [ '^present$', '^absent$' ], "${ensure} isn't supported. Valid values are 'present' and 'absent'.") @@ -34,7 +36,7 @@ object_name => 'command', object_type => 'ExternalCommandListener', attrs => $attrs, - target => "${::conf_dir}/features-available/command.conf", + target => "${conf_dir}/features-available/command.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -44,7 +46,7 @@ # import library 'compat' concat::fragment { 'icinga2::feature::command': - target => "${::conf_dir}/features-available/command.conf", + target => "${conf_dir}/features-available/command.conf", content => "library \"compat\"\n\n", order => '05', } diff --git a/manifests/feature/compatlog.pp b/manifests/feature/compatlog.pp index 6d8bf9afd..c1cb89c1d 100644 --- a/manifests/feature/compatlog.pp +++ b/manifests/feature/compatlog.pp @@ -23,7 +23,9 @@ $ensure = present, $log_dir = "${::icinga2::params::log_dir}/compat", $rotation_method = 'DAILY', -) inherits icinga2::params { +) { + + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], @@ -42,7 +44,7 @@ object_name => 'compatlog', object_type => 'CompatLogger', attrs => $attrs, - target => "${::conf_dir}/features-available/compatlog.conf", + target => "${conf_dir}/features-available/compatlog.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -52,7 +54,7 @@ # import library 'compat' concat::fragment { 'icinga2::feature::compatlog': - target => "${::conf_dir}/features-available/compatlog.conf", + target => "${conf_dir}/features-available/compatlog.conf", content => "library \"compat\"\n\n", order => '05', } diff --git a/manifests/feature/debuglog.pp b/manifests/feature/debuglog.pp index f689f238a..0db8915d0 100644 --- a/manifests/feature/debuglog.pp +++ b/manifests/feature/debuglog.pp @@ -19,7 +19,9 @@ class icinga2::feature::debuglog( $ensure = present, $path = "${::icinga2::params::log_dir}/debug.log", -) inherits icinga2::params { +) { + + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], @@ -37,7 +39,7 @@ object_name => 'debug-file', object_type => 'FileLogger', attrs => $attrs, - target => "${::conf_dir}/features-available/debuglog.conf", + target => "${conf_dir}/features-available/debuglog.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], diff --git a/manifests/feature/gelf.pp b/manifests/feature/gelf.pp index 0bdc8e8a7..98fa1e352 100644 --- a/manifests/feature/gelf.pp +++ b/manifests/feature/gelf.pp @@ -31,8 +31,6 @@ $enable_send_perfdata = false, ) { - include ::icinga2::params - $conf_dir = $::icinga2::params::conf_dir # validation diff --git a/manifests/feature/graphite.pp b/manifests/feature/graphite.pp index 5d00f5121..3a23c0ac9 100644 --- a/manifests/feature/graphite.pp +++ b/manifests/feature/graphite.pp @@ -39,8 +39,6 @@ $enable_send_metadata = false, ) { - include ::icinga2::params - $conf_dir = $::icinga2::params::conf_dir # validation diff --git a/manifests/feature/idomysql.pp b/manifests/feature/idomysql.pp index 6f71b5e8b..dd5ddad79 100644 --- a/manifests/feature/idomysql.pp +++ b/manifests/feature/idomysql.pp @@ -152,10 +152,19 @@ $import_schema = false, ) { - include ::icinga2::params - require ::icinga2::config + $owner = $::icinga2::params::user + $group = $::icinga2::params::group + $node_name = $::icinga2::_constants['NodeName'] + $conf_dir = $::icinga2::params::conf_dir + $ssl_dir = "${::icinga2::params::pki_dir}/ido-mysql" + + File { + owner => $owner, + group => $group, + } + validate_re($ensure, [ '^present$', '^absent$' ], "${ensure} isn't supported. Valid values are 'present' and 'absent'.") validate_string($host) @@ -178,19 +187,6 @@ if $ssl_capath { validate_absolute_path($ssl_capath) } if $ssl_cipher { validate_string($ssl_cipher) } - $owner = $::icinga2::params::user - $group = $::icinga2::params::group - $node_name = $::icinga2::_constants['NodeName'] - - $conf_dir = $::icinga2::params::conf_dir - - $ssl_dir = "${::icinga2::params::pki_dir}/ido-mysql" - - File { - owner => $owner, - group => $group, - } - # Set defaults for certificate stuff and/or do validation if $ssl_key_path { validate_absolute_path($ssl_key_path) diff --git a/manifests/feature/idopgsql.pp b/manifests/feature/idopgsql.pp index 680babb2b..d31a9b03e 100644 --- a/manifests/feature/idopgsql.pp +++ b/manifests/feature/idopgsql.pp @@ -92,6 +92,8 @@ require ::icinga2::config + $conf_dir = $::icinga2::params::conf_dir + validate_re($ensure, [ '^present$', '^absent$' ], "${ensure} isn't supported. Valid values are 'present' and 'absent'.") validate_string($host) @@ -108,8 +110,6 @@ if $categories { validate_array($categories) } validate_bool($import_schema) - $conf_dir = $::icinga2::params::conf_dir - package { 'icinga2-ido-pgsql': ensure => installed, } diff --git a/manifests/feature/influxdb.pp b/manifests/feature/influxdb.pp index 3930cd76a..97ae97de1 100644 --- a/manifests/feature/influxdb.pp +++ b/manifests/feature/influxdb.pp @@ -124,7 +124,16 @@ $flush_threshold = 1024 ) { - include ::icinga2::params + $user = $::icinga2::params::user + $group = $::icinga2::params::group + $node_name = $::icinga2::_constants['NodeName'] + $conf_dir = $::icinga2::params::conf_dir + $ssl_dir = "${::icinga2::params::pki_dir}/influxdb" + + File { + owner => $user, + group => $group, + } validate_re($ensure, [ '^present$', '^absent$' ], "${ensure} isn't supported. Valid values are 'present' and 'absent'.") @@ -145,20 +154,9 @@ validate_re($flush_interval, '^\d+[ms]*$') validate_integer($flush_threshold) - $user = $::icinga2::params::user - $group = $::icinga2::params::group - $node_name = $::icinga2::_constants['NodeName'] - $conf_dir = $::icinga2::params::conf_dir - $ssl_dir = "${::icinga2::params::pki_dir}/influxdb" - $host_template = { measurement => "${host_measurement}", tags => $host_tags } $service_template = { measurement => "${service_measurement}", tags => $service_tags} - File { - owner => $user, - group => $group, - } - # Set defaults for certificate stuff and/or do validation if $ssl_key_path { validate_absolute_path($ssl_key_path) diff --git a/manifests/feature/livestatus.pp b/manifests/feature/livestatus.pp index 58329152b..ae79b5461 100644 --- a/manifests/feature/livestatus.pp +++ b/manifests/feature/livestatus.pp @@ -40,7 +40,9 @@ $bind_port = '6558', $socket_path = "${::icinga2::params::run_dir}/cmd/livestatus", $compat_log_path = "${::icinga2::params::log_dir}/compat", -) inherits icinga2::params { +) { + + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], @@ -66,7 +68,7 @@ object_name => 'livestatus', object_type => 'LivestatusListener', attrs => $attrs, - target => "${::conf_dir}/features-available/livestatus.conf", + target => "${conf_dir}/features-available/livestatus.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -76,7 +78,7 @@ # import library 'livestatus' concat::fragment { 'icinga2::feature::livestatus': - target => "${::conf_dir}/features-available/livestatus.conf", + target => "${conf_dir}/features-available/livestatus.conf", content => "library \"livestatus\"\n\n", order => '05', } diff --git a/manifests/feature/mainlog.pp b/manifests/feature/mainlog.pp index 9fa78872a..a6a32f565 100644 --- a/manifests/feature/mainlog.pp +++ b/manifests/feature/mainlog.pp @@ -22,7 +22,9 @@ $ensure = present, $severity = 'information', $path = "${::icinga2::params::log_dir}/icinga2.log", -) inherits ::icinga2::params { +) { + + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], @@ -41,7 +43,7 @@ object_name => 'main-log', object_type => 'FileLogger', attrs => $attrs, - target => "${::conf_dir}/features-available/mainlog.conf", + target => "${conf_dir}/features-available/mainlog.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], diff --git a/manifests/feature/notification.pp b/manifests/feature/notification.pp index c7ab587e4..d143d1e67 100644 --- a/manifests/feature/notification.pp +++ b/manifests/feature/notification.pp @@ -15,9 +15,7 @@ $ensure = present, ) { - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], diff --git a/manifests/feature/opentsdb.pp b/manifests/feature/opentsdb.pp index 25bd875f5..fcce40817 100644 --- a/manifests/feature/opentsdb.pp +++ b/manifests/feature/opentsdb.pp @@ -23,9 +23,7 @@ $port = '4242', ) { - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], diff --git a/manifests/feature/perfdata.pp b/manifests/feature/perfdata.pp index 51870ceed..383564b9a 100644 --- a/manifests/feature/perfdata.pp +++ b/manifests/feature/perfdata.pp @@ -51,7 +51,9 @@ $host_format_template = undef, $service_format_template = undef, $rotation_interval = '30s', -) inherits icinga2::params { +) { + + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], @@ -83,7 +85,7 @@ object_name => 'perfdata', object_type => 'PerfdataWriter', attrs => $attrs, - target => "${::conf_dir}/features-available/perfdata.conf", + target => "${conf_dir}/features-available/perfdata.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -93,7 +95,7 @@ # import library 'perfdata' concat::fragment { 'icinga2::feature::perfdata': - target => "${::conf_dir}/features-available/perfdata.conf", + target => "${conf_dir}/features-available/perfdata.conf", content => "library \"perfdata\"\n\n", order => '05', } diff --git a/manifests/feature/statusdata.pp b/manifests/feature/statusdata.pp index 34eb09633..e83fedd58 100644 --- a/manifests/feature/statusdata.pp +++ b/manifests/feature/statusdata.pp @@ -30,7 +30,9 @@ $status_path = "${::icinga2::params::cache_dir}/status.dat", $objects_path = "${::icinga2::params::cache_dir}/objects.cache", $update_interval = '15s', -) inherits icinga2::params { +) { + + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], @@ -51,7 +53,7 @@ object_name => 'statusdata', object_type => 'StatusDataWriter', attrs => $attrs, - target => "${::conf_dir}/features-available/statusdata.conf", + target => "${conf_dir}/features-available/statusdata.conf", order => '10', notify => $ensure ? { 'present' => Class['::icinga2::service'], @@ -61,7 +63,7 @@ # import library 'compat' concat::fragment { 'icinga2::feature::statusdata': - target => "${::conf_dir}/features-available/statusdata.conf", + target => "${conf_dir}/features-available/statusdata.conf", content => "library \"compat\"\n\n", order => '05', } diff --git a/manifests/feature/syslog.pp b/manifests/feature/syslog.pp index ed8820ebb..213488dcd 100644 --- a/manifests/feature/syslog.pp +++ b/manifests/feature/syslog.pp @@ -20,9 +20,7 @@ $severity = 'warning', ) { - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir + $conf_dir = $::icinga2::params::conf_dir # validation validate_re($ensure, [ '^present$', '^absent$' ], From fffce5fa3f6eb3bef96b5e01e10e23973e47412c Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Wed, 4 Jan 2017 09:49:28 +0100 Subject: [PATCH 3/3] Remove comment in Rakefile --- Rakefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Rakefile b/Rakefile index f3a2876b2..7e6cb3a63 100644 --- a/Rakefile +++ b/Rakefile @@ -25,7 +25,3 @@ task :validate do sh "erb -P -x -T '-' #{template} | ruby -c" end end - -#PuppetLint::RakeTask.new :lint do |config| -# config.pattern = 'manifests/*/**.pp' -#end