From a550988c7852b1dee7dad74f5219eac9a2147fbd Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Sat, 18 Nov 2017 10:09:52 +0100 Subject: [PATCH 1/4] fix #403 repository.d missing --- README.md | 8 ++++++++ manifests/config.pp | 12 ++++++++++++ manifests/init.pp | 6 ++++++ templates/icinga2.conf.erb | 2 ++ 4 files changed, 28 insertions(+) diff --git a/README.md b/README.md index e580260b7..1fb315502 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ Icinga 2 is a widely used open source monitoring software. This Puppet module helps with installing and managing configuration of Icinga 2 on multiple operating systems. +### Notices + +For Icinga 2 v2.8.0 and higher version v1.3.4 and above is needed. See issue #403. + ## Module Description This module installs and configures Icinga 2 on your Linux or Windows hosts. @@ -879,6 +883,10 @@ set this parameter to `false`. By default this parameter is `true`. It's also po own directory. This directory and must be managed outside of this module as file resource with tag icinga2::config::file. +##### `repositoryd` +`repository.d` is removed since Icinga 2 2.8.0, set to true (default) will handle the directory. +This Parameter will change to false by default in v2.0.0 and will be removed in the future. + #### Class: `icinga2::feature::checker` Enables or disables the `checker` feature. diff --git a/manifests/config.pp b/manifests/config.pp index 4b60e32e6..5e0c83c7f 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -19,7 +19,10 @@ $conf_dir = $::icinga2::params::conf_dir $plugins = $::icinga2::plugins $confd = $::icinga2::_confd + $repositoryd = $::icinga2::repositoryd $purge_features = $::icinga2::purge_features + $user = $::icinga2::params::user + $group = $::icinga2::params::group if $::kernel != 'windows' { $template_constants = icinga2_attributes($constants) @@ -29,6 +32,15 @@ $template_mainconfig = regsubst(template('icinga2/icinga2.conf.erb'), '\n', "\r\n", 'EMG') } + # deprecated, removed in Icinga 2 v2.8.0 + if $repositoryd { + file { "${conf_dir}/repository.d": + ensure => directoy, + owner => $user, + group => $group, + } + } + file { "${conf_dir}/constants.conf": ensure => file, content => $template_constants, diff --git a/manifests/init.pp b/manifests/init.pp index e9e6f3487..d004acf1e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -41,6 +41,10 @@ # own directory. This directory must be managed outside of this module as file resource # with tag icinga2::config::file. # +# [*repositoryd*] +# `repository.d` is removed since Icinga 2 2.8.0, set to true (default) will handle the directory. +# This Parameter will change to false by default in v2.0.0 and will be removed in the future. +# # All default parameters are set in the icinga2::params class. To get more technical information have a look into the # params.pp manifest. # @@ -148,6 +152,7 @@ $constants = {}, $plugins = $icinga2::params::plugins, $confd = true, + $repositoryd = true, ) inherits ::icinga2::params { validate_re($ensure, [ '^running$', '^stopped$' ], @@ -160,6 +165,7 @@ validate_bool($purge_features) validate_hash($constants) validate_array($plugins) + validate_bool($repositoryd) # validate confd, boolean or string if is_bool($confd) { diff --git a/templates/icinga2.conf.erb b/templates/icinga2.conf.erb index d206d9385..c00d48a6c 100644 --- a/templates/icinga2.conf.erb +++ b/templates/icinga2.conf.erb @@ -38,12 +38,14 @@ include <<%= p %>> * the features-enabled directory. */ include "features-enabled/*.conf" +<% if @repositoryd -%> /** * The repository.d directory contains all configuration objects * managed by the 'icinga2 repository' CLI commands. */ include_recursive "repository.d" +<% end -%> <% if @confd -%> /** From a67b1caa91adeaa06e6ed155ba3f604ae4f6ad5f Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Sat, 18 Nov 2017 10:12:53 +0100 Subject: [PATCH 2/4] remove management of repositoryd from config.pp to install.pp --- manifests/config.pp | 12 ------------ manifests/install.pp | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 5e0c83c7f..4b60e32e6 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -19,10 +19,7 @@ $conf_dir = $::icinga2::params::conf_dir $plugins = $::icinga2::plugins $confd = $::icinga2::_confd - $repositoryd = $::icinga2::repositoryd $purge_features = $::icinga2::purge_features - $user = $::icinga2::params::user - $group = $::icinga2::params::group if $::kernel != 'windows' { $template_constants = icinga2_attributes($constants) @@ -32,15 +29,6 @@ $template_mainconfig = regsubst(template('icinga2/icinga2.conf.erb'), '\n', "\r\n", 'EMG') } - # deprecated, removed in Icinga 2 v2.8.0 - if $repositoryd { - file { "${conf_dir}/repository.d": - ensure => directoy, - owner => $user, - group => $group, - } - } - file { "${conf_dir}/constants.conf": ensure => file, content => $template_constants, diff --git a/manifests/install.pp b/manifests/install.pp index d22d960cf..cf1bdb165 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -19,6 +19,7 @@ $package = $::icinga2::params::package $manage_package = $::icinga2::manage_package $pki_dir = $::icinga2::params::pki_dir + $repositoryd = $::icinga2::repositoryd $conf_dir = $::icinga2::params::conf_dir $user = $::icinga2::params::user $group = $::icinga2::params::group @@ -37,5 +38,15 @@ owner => $user, group => $group, } + + # deprecated, removed in Icinga 2 v2.8.0 + if $repositoryd { + file { "${conf_dir}/repository.d": + ensure => directoy, + owner => $user, + group => $group, + } + } + } From 9d0bf5ebe01cbd2d7b670a16c25d3e48faaeb254 Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Sat, 18 Nov 2017 13:15:38 +0100 Subject: [PATCH 3/4] add dependency to repositoryd --- manifests/install.pp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index cf1bdb165..69bc110f6 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -42,9 +42,10 @@ # deprecated, removed in Icinga 2 v2.8.0 if $repositoryd { file { "${conf_dir}/repository.d": - ensure => directoy, - owner => $user, - group => $group, + ensure => directoy, + owner => $user, + group => $group, + require => File[$conf_dir], } } From 2070fa5390ede4ff327f3db5b76f157be8055b2c Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Sat, 18 Nov 2017 14:59:55 +0100 Subject: [PATCH 4/4] add repositoryd to always be managed incl. absent --- README.md | 3 ++- manifests/install.pp | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1fb315502..cfcfd960f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ configuration of Icinga 2 on multiple operating systems. ### Notices -For Icinga 2 v2.8.0 and higher version v1.3.4 and above is needed. See issue #403. +For Icinga 2 v2.8.0 and higher version v1.3.4 and above is needed and the parameter repositoryd +can set to false. See issue #403. ## Module Description diff --git a/manifests/install.pp b/manifests/install.pp index 69bc110f6..b42227a49 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -19,10 +19,10 @@ $package = $::icinga2::params::package $manage_package = $::icinga2::manage_package $pki_dir = $::icinga2::params::pki_dir - $repositoryd = $::icinga2::repositoryd $conf_dir = $::icinga2::params::conf_dir $user = $::icinga2::params::user $group = $::icinga2::params::group + $repositoryd = $::icinga2::repositoryd if $manage_package { if $::osfamily == 'windows' { Package { provider => chocolatey, } } @@ -40,13 +40,19 @@ } # deprecated, removed in Icinga 2 v2.8.0 - if $repositoryd { - file { "${conf_dir}/repository.d": - ensure => directoy, - owner => $user, - group => $group, - require => File[$conf_dir], - } + $_ensure = $repositoryd ? { + true => 'directory', + default => 'absent', + } + + file { "${conf_dir}/repository.d": + ensure => $_ensure, + owner => $user, + group => $group, + recurse => true, + purge => true, + force => true, + require => File[$pki_dir, $conf_dir], } }