diff --git a/AUTHORS b/AUTHORS index a425a1d..2e4bc31 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,45 +1,48 @@ Alan Jenkins Alessandro Lorenzi +Alexander Schaber Alexander Schaber Andrea Cervesato Andreas Ntaflos Andreas Paul Ben Ford Benedikt Trefzer Benjamin Akhras Blerim Sheqa David Raison Dirk Goetz Erez Zarum Ewoud Kohl van Wijngaarden Fionera Florian Baumann Gordon Bleux Gunnar Beutner Henry Pauli James Fryman Jan-Otto Kröpke Jerome Charaoui Lennart Betz Markus Frosch Matthias Baur Matthias Ritter Michael Friedrich Ott, Jörn WI (Fa. Allgeier Experts / Goetzfried) Philipp Dallig Rowan Ruseler +Rowan Ruseler Rudy Gevaert +Simon Hoenscheid Simon Hoenscheid Stefan Kleindl Thomas Dalichow Thomas Gelf Thorsten Kahler Till Adam Tim Meusel Tom De Vylder Tomas Barton Wyatt Alt Zach Leslie jas01 murmur paladox diff --git a/TESTING.md b/TESTING.md index 72bf94f..3dfcfd0 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,90 +1,89 @@ # TESTING # TESTING ## Prerequisites Before starting any test, you should make sure you have installed the Puppet PDK and Bolt, also Vagrant and VirtualBox have to be installed for acceptance tests. Required gems are installed with `bundler`: ``` cd puppet-icinga2 pdk bundle install ``` ## Validation tests Validation tests will check all manifests, templates and ruby files against syntax violations and style guides . Run validation tests: ``` cd puppet-icinga2 pdk bundle exec rake validate ``` ## Puppet lint With puppet-lint we test if our manifests conform to the recommended style guides from Puppet. Run lint tests: ``` cd puppet-icinga2 pdk bundle exec rake lint ``` ## Unit tests For unit testing we use [RSpec]. All classes, defined resource types and functions should have appropriate unit tests. Run unit tests: ``` cd puppet-icinga2 pdk test unit -pdk test unit --tests=repos ``` Or dedicated tests: ``` -pdk test unit --tests=spec/classes/repos_spec.rb,spec/classes/redis_spec.rb +pdk test unit --tests=spec/classes/icinga2_spec.rb,spec/classes/api_spec.rb ``` ## Acceptence tests With integration tests this module is tested on multiple platforms to check the complete installation process. We define these tests with [Beaker] and run them on VMs by using [Vagrant]. ### Run tests All available Beaker acceptance tests are listed in the `spec/acceptance` directory. Run all integraion tests: ``` cd puppet-icinga2 pdk bundle exec rake beaker ``` Run integration tests for a single platform: ``` cd puppet-icinga2 pdk bundle exec rake beaker:centos-6-x64 ``` To choose a specific Puppet version for your tests set the environment variable, e.g. ``` BEAKER_PUPPET_AGENT_VERSION="6.4.2" ``` Debugging: Does not destroy a virtual machine after a test fails is done by setting: ``` BEAKER_destroy=no ``` Logging in virtual machine, e.g. ``` cd puppet-icinga2 pdk bundle exec rake beaker:ssh:centos-6-x64 ``` or in the default machine: ``` cd puppet-icinga2 pdk bundle exec rake beaker:ssh:default ``` diff --git a/examples/init_package_idopgsql.pp b/examples/init_package_idopgsql.pp index bcbc0f9..88f5789 100644 --- a/examples/init_package_idopgsql.pp +++ b/examples/init_package_idopgsql.pp @@ -1,18 +1,18 @@ include ::icinga2::repo package { ['icinga2', 'icinga2-ido-pgsql']: ensure => latest, notify => Class['icinga2'], } class{ 'icinga2': manage_packages => false, } class{ 'icinga2::feature::idopgsql': - host => '127.0.0.1' - user => 'icinga2' - password => 'icinga2' - database => 'icinga2' - import_schema => true + host => '127.0.0.1', + user => 'icinga2', + password => 'icinga2', + database => 'icinga2', + import_schema => true, } diff --git a/manifests/feature/syslog.pp b/manifests/feature/syslog.pp index 2b0abd9..e956b1a 100644 --- a/manifests/feature/syslog.pp +++ b/manifests/feature/syslog.pp @@ -1,52 +1,52 @@ # @summary # Configures the Icinga 2 feature syslog. # # @param [Enum['absent', 'present']] ensure # Set to present enables the feature syslog, absent disables it. # -# @param [Optional[Icinga2::LogSeverity]] severity +# @param [Icinga2::LogSeverity] severity # You can choose the log severity between information, notice, warning or debug. # # @param [Optional[Icinga2::LogFacility]] facility # Defines the facility to use for syslog entries. This can be a facility constant # like FacilityDaemon. # class icinga2::feature::syslog( Enum['absent', 'present'] $ensure = present, - Optional[Icinga2::LogSeverity] $severity = undef, + Icinga2::LogSeverity $severity = 'warning', Optional[Icinga2::LogFacility] $facility = undef, ) { if ! defined(Class['::icinga2']) { fail('You must include the icinga2 base class before using any icinga2 feature class!') } $conf_dir = $::icinga2::globals::conf_dir $_notify = $ensure ? { 'present' => Class['::icinga2::service'], default => undef, } # compose attributes $attrs = { severity => $severity, facility => $facility, } # create object icinga2::object { 'icinga2::object::SyslogLogger::syslog': object_name => 'syslog', object_type => 'SyslogLogger', attrs => delete_undef_values($attrs), attrs_list => keys($attrs), target => "${conf_dir}/features-available/syslog.conf", order => 10, notify => $_notify, } # manage feature icinga2::feature { 'syslog': ensure => $ensure, } } diff --git a/manifests/service.pp b/manifests/service.pp index e3c6b21..c260006 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,42 +1,42 @@ # @summary # This class handles the Icinga 2 service. By default the service will # start on boot and will be restarted if stopped. # # @api private # class icinga2::service { assert_private() $ensure = $::icinga2::ensure $enable = $::icinga2::enable $manage_service = $::icinga2::manage_service $service_name = $::icinga2::globals::service_name $reload = $::icinga2::globals::service_reload $logon_account = $::icinga2::globals::logon_account $hasrestart = $reload ? { undef => false, default => true, } if $manage_service { if $facts['os']['kernel'] == 'windows' and versioncmp($::puppetversion, '6.18.0') >= 0 { service { $service_name: ensure => $ensure, enable => $enable, hasrestart => $hasrestart, restart => $reload, logonaccount => $logon_account, } } else { service { $service_name: - ensure => $ensure, - enable => $enable, - hasrestart => $hasrestart, - restart => $reload, + ensure => $ensure, + enable => $enable, + hasrestart => $hasrestart, + restart => $reload, } } } } diff --git a/metadata.json b/metadata.json index 4e44dba..01909e8 100644 --- a/metadata.json +++ b/metadata.json @@ -1,108 +1,107 @@ { "name": "icinga-icinga2", "version": "3.1.2", "author": "Icinga Development Team", "summary": "Icinga 2 Puppet Module", "license": "Apache-2.0", "source": "git://github.com/icinga/puppet-icinga2", "project_page": "https://github.com/icinga/puppet-icinga2", "issues_url": "https://github.com/icinga/puppet-icinga2/issues", "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": ">= 5.0.0 < 8.0.0" }, { "name": "puppetlabs/concat", "version_requirement": ">= 2.1.0 < 8.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "Windows", "operatingsystemrelease": [ "Server 2012", "Server 2012 R2", "Server 2016", "Server 2019" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "6", "7", "8" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "6", "7", "8" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "6", "7", "8" ] }, { "operatingsystem": "Fedora", "operatingsystemrelease": [ - "26", - "27", - "28", - "29", - "30", - "31" + "31", + "32", + "33", + "34" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ "8", "9", "10" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "16.04", "18.04", "20.04" ] }, { "operatingsystem": "SLES", "operatingsystemrelease": [ "12", "15" ] }, { "operatingsystem": "FreeBSD", "operatingsystemrelease": [ "11", - "10" + "12", + "13" ] } ], "requirements": [ { "name": "puppet", "version_requirement": ">= 4.10.0 < 8.0.0" } ], "tags": [ "monitoring" ], "pdk-version": "1.18.1", "template-url": "pdk-default#1.18.1", "template-ref": "tags/1.18.1-0-g3d2e75c" }