From d6dd841fcbc702b000b2303b4a28e1c68d664a34 Mon Sep 17 00:00:00 2001 From: Andrea Cervesato Date: Fri, 19 Jan 2018 17:29:52 +0100 Subject: [PATCH 01/11] Added cloudlinux to supported operating systems. Is nearly identical to Centos --- manifests/repo.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index b0a4da631..0c87755f2 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -23,7 +23,7 @@ case $::osfamily { 'redhat': { case $::operatingsystem { - 'centos', 'redhat', 'oraclelinux': { + 'centos', 'redhat', 'oraclelinux', 'cloudlinux': { yumrepo { 'icinga-stable-release': baseurl => "http://packages.icinga.com/epel/${::operatingsystemmajrelease}/release/", descr => 'ICINGA (stable release for epel)', From 51729f352552869c32f8355e1213d9032b18cc09 Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Tue, 23 Jan 2018 09:00:30 +0100 Subject: [PATCH 02/11] Workaround Travis CI bug #8969 https://github.com/travis-ci/travis-ci/issues/8969 --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f88d27494..8cf2512a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,6 @@ cache: bundler before_install: - bundle -v - rm Gemfile.lock || true - - gem update --system - - gem update bundler - gem --version - bundle -v script: From 434f8424590163082232b8e71599e3fc4f522495 Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Wed, 24 Jan 2018 08:46:13 +0100 Subject: [PATCH 03/11] Update AUTHORS --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index 9583da414..8da75eecd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,7 @@ Alan Jenkins Alessandro Lorenzi Alexander Schaber +Andrea Cervesato Andreas Ntaflos Andreas Paul Blerim Sheqa @@ -21,6 +22,8 @@ Rudy Gevaert Simon Hoenscheid Stefan Kleindl Thomas Dalichow +Till Adam Tom De Vylder Tomas Barton +Wyatt Alt Zach Leslie From 6412e421cbfac31b696fa1bca81d6f6f9af1d899 Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Wed, 24 Jan 2018 08:47:46 +0100 Subject: [PATCH 04/11] Release version 1.3.5 --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ metadata.json | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dea03521..b2204df3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Change Log +## [v1.3.5](https://github.com/Icinga/puppet-icinga2/tree/v1.3.5) (2018-01-24) +[Full Changelog](https://github.com/Icinga/puppet-icinga2/compare/v1.3.4...v1.3.5) + +**Implemented enhancements:** + +- icinga2 binary is wrong on rhel5 [\#409](https://github.com/Icinga/puppet-icinga2/issues/409) +- Add feature Elasticsearch [\#408](https://github.com/Icinga/puppet-icinga2/issues/408) +- Add feature elasticsearch [\#399](https://github.com/Icinga/puppet-icinga2/issues/399) +- Added cloudlinux to supported operating systems. Is nearly identical … [\#424](https://github.com/Icinga/puppet-icinga2/pull/424) ([koma85](https://github.com/koma85)) + +**Fixed bugs:** + +- Setting up icinga2 with a different port than default for idodb leads to an error [\#411](https://github.com/Icinga/puppet-icinga2/issues/411) +- fix \#411 Setting up Icinga 2 with a different port than default for i… [\#413](https://github.com/Icinga/puppet-icinga2/pull/413) ([lbetz](https://github.com/lbetz)) +- fix for repository.d directory on master-systems [\#412](https://github.com/Icinga/puppet-icinga2/pull/412) ([matthiasritter](https://github.com/matthiasritter)) + +**Closed issues:** + +- escaping broken with double quotes? [\#416](https://github.com/Icinga/puppet-icinga2/issues/416) +- Icinga resource doesn't create ca directory and required files [\#415](https://github.com/Icinga/puppet-icinga2/issues/415) +- icinga2 option generates self signed certificates that are rejected by master [\#405](https://github.com/Icinga/puppet-icinga2/issues/405) +- manage repo trough proxy [\#394](https://github.com/Icinga/puppet-icinga2/issues/394) + +**Merged pull requests:** + +- trivial copy edits [\#420](https://github.com/Icinga/puppet-icinga2/pull/420) ([wkalt](https://github.com/wkalt)) +- Fix confd example path [\#417](https://github.com/Icinga/puppet-icinga2/pull/417) ([dnsmichi](https://github.com/dnsmichi)) +- fix \#409 icinga2 binary is wrong on rhel5 [\#410](https://github.com/Icinga/puppet-icinga2/pull/410) ([lbetz](https://github.com/lbetz)) + ## [v1.3.4](https://github.com/Icinga/puppet-icinga2/tree/v1.3.4) (2017-11-22) [Full Changelog](https://github.com/Icinga/puppet-icinga2/compare/v1.3.3...v1.3.4) diff --git a/metadata.json b/metadata.json index 730c56456..658e2c972 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "icinga-icinga2", - "version": "1.3.4", + "version": "1.3.5", "author": "Icinga Development Team", "summary": "Icinga 2 Puppet Module", "license": "Apache-2.0", From 0b3d2210e1e0804470236dec70be5c214cf1c65f Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Fri, 2 Mar 2018 13:04:08 +0100 Subject: [PATCH 05/11] add log, .vendor to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8912186e6..bb61d6586 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ pkg/ Gemfile.lock /.ruby-* .bundle +.vendor/ vendor/ +log/ From dd6023f6c1f1bc1b5587832e88ef69c1801d8254 Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Fri, 2 Mar 2018 13:12:05 +0100 Subject: [PATCH 06/11] fix #433 null does not quoted --- lib/puppet_x/icinga2/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet_x/icinga2/utils.rb b/lib/puppet_x/icinga2/utils.rb index 82f48b861..ab13d6e08 100644 --- a/lib/puppet_x/icinga2/utils.rb +++ b/lib/puppet_x/icinga2/utils.rb @@ -86,7 +86,7 @@ def self.attributes(attrs, globals, consts, indent=2) def self.value_types(value) - if value =~ /^\d+\.?\d*[dhms]?$/ || value =~ /^(true|false)$/ || value =~ /^!?(host|service|user)\./ || value =~ /^\{{2}.*\}{2}$/ + if value =~ /^\d+\.?\d*[dhms]?$/ || value =~ /^(true|false|null)$/ || value =~ /^!?(host|service|user)\./ || value =~ /^\{{2}.*\}{2}$/ result = value else if $constants.index { |x| if $hash_attrs.include?(x) then value =~ /^!?(#{x})(\..+$|$)/ else value =~ /^!?#{x}$/ end } From b1370f9800d0886051d6fd1457fcb50dc9c4ecfc Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Fri, 2 Mar 2018 13:28:40 +0100 Subject: [PATCH 07/11] fix #434 concat <2.1.0 has a bug that does not trigger a refresh --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 658e2c972..92df0ff7f 100644 --- a/metadata.json +++ b/metadata.json @@ -13,7 +13,7 @@ ], "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.16.0 < 5.0.0" }, - { "name": "puppetlabs/concat", "version_requirement": ">= 2.0.1 < 5.0.0" } + { "name": "puppetlabs/concat", "version_requirement": ">= 2.1.0 < 5.0.0" } ], "operatingsystem_support": [ { From 77c18974e9e11cdfc3bf7031d0bc1867f56daf0a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Thu, 15 Mar 2018 12:06:51 -0400 Subject: [PATCH 08/11] Support manage_repo on XenServer XenServer is an Citrix appliance based on CentOS 7. Tested to work. --- manifests/repo.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index 0c87755f2..a44483ceb 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -23,7 +23,7 @@ case $::osfamily { 'redhat': { case $::operatingsystem { - 'centos', 'redhat', 'oraclelinux', 'cloudlinux': { + 'centos', 'redhat', 'oraclelinux', 'cloudlinux', 'xenserver': { yumrepo { 'icinga-stable-release': baseurl => "http://packages.icinga.com/epel/${::operatingsystemmajrelease}/release/", descr => 'ICINGA (stable release for epel)', From fd504106907b4b34b2acfb2d40588a5317c6870b Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Fri, 13 Apr 2018 19:34:54 +0200 Subject: [PATCH 09/11] fix requirements --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce3985ab6..ecaf9bb9f 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,8 @@ available in Icinga 2 can be enabled and configured with this module. This module depends on: -* [puppetlabs/stdlib] >= 4.10.0 -* [puppetlabs/concat] >= 2.0.1 +* [puppetlabs/stdlib] >= 4.16.0 +* [puppetlabs/concat] >= 2.1.0 Depending on your setup following modules may also be required: From 40ab462c0e2b75c4bd0c12605b6e42c79308947b Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Fri, 28 Jul 2017 17:13:30 +0200 Subject: [PATCH 10/11] replace validate_* with data types --- .travis.yml | 34 +++--- examples/example4/profile/manifests/agent.pp | 14 +-- examples/example4/profile/manifests/slave.pp | 18 ++- manifests/config/fragment.pp | 12 +- manifests/debian/dbconfig.pp | 23 ++-- manifests/feature.pp | 7 +- manifests/feature/api.pp | 76 ++++--------- manifests/feature/checker.pp | 10 +- manifests/feature/command.pp | 8 +- manifests/feature/compatlog.pp | 12 +- manifests/feature/debuglog.pp | 9 +- manifests/feature/gelf.pp | 18 +-- manifests/feature/graphite.pp | 24 ++-- manifests/feature/idomysql.pp | 79 +++++-------- manifests/feature/idopgsql.pp | 44 +++---- manifests/feature/influxdb.pp | 68 ++++------- manifests/feature/livestatus.pp | 22 +--- manifests/feature/mainlog.pp | 12 +- manifests/feature/notification.pp | 11 +- manifests/feature/opentsdb.pp | 12 +- manifests/feature/perfdata.pp | 30 ++--- manifests/feature/statusdata.pp | 15 +-- manifests/feature/syslog.pp | 9 +- manifests/init.pp | 46 +++----- manifests/object.pp | 45 +++----- manifests/object/apiuser.pp | 27 ++--- manifests/object/checkcommand.pp | 40 ++----- manifests/object/checkresultreader.pp | 22 +--- manifests/object/compatlogger.pp | 28 +---- manifests/object/dependency.pp | 66 ++++------- manifests/object/endpoint.pp | 32 ++---- manifests/object/eventcommand.pp | 37 ++---- manifests/object/host.pp | 106 ++++++----------- manifests/object/hostgroup.pp | 28 ++--- manifests/object/notification.pp | 102 ++++++----------- manifests/object/notificationcommand.pp | 40 ++----- manifests/object/scheduleddowntime.pp | 54 +++------ manifests/object/service.pp | 114 ++++++------------- manifests/object/servicegroup.pp | 36 ++---- manifests/object/timeperiod.pp | 41 ++----- manifests/object/user.pp | 53 +++------ manifests/object/usergroup.pp | 35 ++---- manifests/object/zone.pp | 36 ++---- manifests/pki/ca.pp | 21 ++-- manifests/repo.pp | 4 +- spec/classes/api_spec.rb | 41 +++---- spec/classes/ca_spec.rb | 16 +-- spec/classes/checker_spec.rb | 6 +- spec/classes/command_spec.rb | 6 +- spec/classes/compatlog_spec.rb | 10 +- spec/classes/config_spec.rb | 2 +- spec/classes/debuglog_spec.rb | 4 +- spec/classes/gelf_spec.rb | 10 +- spec/classes/graphite_spec.rb | 16 +-- spec/classes/idomysql_spec.rb | 52 ++++----- spec/classes/idopgsql_spec.rb | 28 ++--- spec/classes/influxdb_spec.rb | 48 ++++---- spec/classes/livestatus_spec.rb | 20 ++-- spec/classes/mainlog_spec.rb | 8 +- spec/classes/notification_spec.rb | 4 +- spec/classes/opentsdb_spec.rb | 8 +- spec/classes/perfdata_spec.rb | 20 ++-- spec/classes/service_spec.rb | 12 +- spec/classes/statusdata_spec.rb | 14 +-- spec/classes/syslog_spec.rb | 6 +- spec/defines/apiuser_spec.rb | 10 +- spec/defines/checkcommand_spec.rb | 16 +-- spec/defines/checkresultreader_spec.rb | 4 +- spec/defines/compatlogger_spec.rb | 8 +- spec/defines/dependency_spec.rb | 16 +-- spec/defines/endpoint_spec.rb | 20 ++-- spec/defines/eventcommand_spec.rb | 16 +-- spec/defines/feature_spec.rb | 15 ++- spec/defines/host_spec.rb | 72 ++++++------ spec/defines/hostgroup_spec.rb | 4 +- spec/defines/notification_spec.rb | 8 +- spec/defines/notificationcommand_spec.rb | 16 +-- spec/defines/object_spec.rb | 44 ++++--- spec/defines/scheduleddowntime_spec.rb | 12 +- spec/defines/service_spec.rb | 60 +++++----- spec/defines/servicegroup_spec.rb | 4 +- spec/defines/timeperiod_spec.rb | 16 +-- spec/defines/user_spec.rb | 16 +-- spec/defines/usergroup_spec.rb | 4 +- spec/defines/zone_spec.rb | 18 +-- 85 files changed, 847 insertions(+), 1443 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8cf2512a3..f1d310c57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,28 +17,22 @@ env: matrix: fast_finish: true include: - - rvm: 2.4.0 - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.3.3 - env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.2.6 - env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.1.10 - env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.1.10 - env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.1.10 - env: PUPPET_VERSION="~> 3.8" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test FIXTURES_YML=.fixtures.puppet3.yml - - rvm: 2.1.10 - env: PUPPET_VERSION="~> 3.8" STRICT_VARIABLES="yes" CHECK=test FIXTURES_YML=.fixtures.puppet3.yml - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.8" STRICT_VARIABLES="yes" CHECK=test FIXTURES_YML=.fixtures.puppet3.yml - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.8" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test FIXTURES_YML=.fixtures.puppet3.yml + - rvm: 2.4.0 + env: PUPPET_VERSION="~> 5.0" CHECK=test + - rvm: 2.3.3 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.2.6 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.1.10 + env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.1.10 + env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=4 + allow_failures: + - rvm: 2.4.0 branches: only: - - master - - /^v\d/ + - master + - /^v\d/ notifications: email: false deploy: diff --git a/examples/example4/profile/manifests/agent.pp b/examples/example4/profile/manifests/agent.pp index 80f6f9929..e0db31bfb 100644 --- a/examples/example4/profile/manifests/agent.pp +++ b/examples/example4/profile/manifests/agent.pp @@ -1,18 +1,16 @@ # Notice: this code contains Puppet 4 syntax! It doesn't run on Puppet 3. class profile::icinga2::agent( - $parent_endpoints, - $parent_zone, - $agent_ip = $::ipaddress, + Hash $parent_endpoints, + String $parent_zone, + Stdlib::Compat::Ip_address $agent_ip = $::ipaddress, ) { contain ::profile::icinga2::plugins - validate_hash($parent_endpoints) - class { '::icinga2': manage_repo => true, confd => false, - features => ['mainlog'], + features => ['mainlog'], } # Feature: api @@ -23,8 +21,8 @@ 'ZoneName' => { 'endpoints' => [ 'NodeName' ], 'parent' => $parent_zone, - } - } + }, + }, } ::icinga2::object::zone { 'linux-commands': diff --git a/examples/example4/profile/manifests/slave.pp b/examples/example4/profile/manifests/slave.pp index 0b4006d9c..bd793e526 100644 --- a/examples/example4/profile/manifests/slave.pp +++ b/examples/example4/profile/manifests/slave.pp @@ -1,22 +1,20 @@ # Notice: this code contains Puppet 4 syntax! It doesn't run on Puppet 3. class profile::icinga2::slave( - $slave_zone, - $parent_endpoints, - $parent_zone = 'master', - $slave_ip = $::ipaddress, + String $slave_zone, + Array $parent_endpoints, + String $parent_zone = 'master', + Stdlib::Compat::Ip_address $slave_ip = $::ipaddress, ) { contain ::profile::icinga2::plugins - validate_array($parent_endpoints) - class { '::icinga2': manage_repo => true, confd => false, - features => ['checker','mainlog'], + features => ['checker','mainlog'], constants => { 'ZoneName' => $slave_zone, - } + }, } # Feature: api @@ -27,8 +25,8 @@ 'ZoneName' => { 'endpoints' => [ 'NodeName' ], 'parent' => $parent_zone, - } - } + }, + }, } ::icinga2::object::endpoint { $parent_endpoints: } diff --git a/manifests/config/fragment.pp b/manifests/config/fragment.pp index 9532257db..1f0d29d74 100644 --- a/manifests/config/fragment.pp +++ b/manifests/config/fragment.pp @@ -16,10 +16,10 @@ # # define icinga2::config::fragment( - $content, - $target, - $code_name = $title, - $order = '0', + String $content, + Stdlib::Absolutepath $target, + String $code_name = $title, + Pattern[/^\d+$/] $order = '0', ) { include ::icinga2::params @@ -44,10 +44,6 @@ } # default } - validate_string($content) - validate_absolute_path($target) - validate_string($order) - if !defined(Concat[$target]) { concat { $target: ensure => present, diff --git a/manifests/debian/dbconfig.pp b/manifests/debian/dbconfig.pp index 5536bc57f..41c0e4db3 100644 --- a/manifests/debian/dbconfig.pp +++ b/manifests/debian/dbconfig.pp @@ -1,26 +1,17 @@ # == Class: icinga2::debian::dbconfig # class icinga2::debian::dbconfig( - $dbtype, - $dbserver, - $dbport, - $dbname, - $dbuser, - $dbpass, - $ssl = false, + Enum['mysql', 'pgsql'] $dbtype, + String $dbserver, + Integer[1,65535] $dbport, + String $dbname, + String $dbuser, + String $dbpass, + Boolean $ssl = false, ) { assert_private() - validate_re($dbtype, [ '^mysql$', '^pgsql$' ], - "${dbtype} isn't supported. Valid values are 'mysql' and 'pgsql'.") - validate_string($dbserver) - validate_integer($dbport) - validate_string($dbname) - validate_string($dbuser) - validate_string($dbpass) - validate_bool($ssl) - # dbconfig config for Debian or Ubuntu if $::osfamily == 'debian' { diff --git a/manifests/feature.pp b/manifests/feature.pp index d886d2649..85429f8b6 100644 --- a/manifests/feature.pp +++ b/manifests/feature.pp @@ -4,15 +4,12 @@ # # define icinga2::feature( - $ensure = present, - $feature = $title, + Enum['absent', 'present'] $ensure = present, + String $feature = $title, ) { assert_private() - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - $user = $::icinga2::params::user $group = $::icinga2::params::group $conf_dir = $::icinga2::params::conf_dir diff --git a/manifests/feature/api.pp b/manifests/feature/api.pp index ce3cfab04..3303b8c21 100644 --- a/manifests/feature/api.pp +++ b/manifests/feature/api.pp @@ -141,26 +141,26 @@ # # class icinga2::feature::api( - $ensure = present, - $pki = 'puppet', - $ssl_key_path = undef, - $ssl_cert_path = undef, - $ssl_csr_path = undef, - $ssl_cacert_path = undef, - $accept_config = false, - $accept_commands = false, - $ca_host = undef, - $ca_port = 5665, - $ticket_salt = 'TicketSalt', - $endpoints = { 'NodeName' => {} }, - $zones = { 'ZoneName' => { endpoints => [ 'NodeName' ] } }, - $ssl_key = undef, - $ssl_cert = undef, - $ssl_cacert = undef, - $ssl_protocolmin = undef, - $ssl_cipher_list = undef, - $bind_host = undef, - $bind_port = undef, + Enum['absent', 'present'] $ensure = present, + Enum['ca', 'icinga2', 'none', 'puppet'] $pki = 'puppet', + Optional[Stdlib::Absolutepath] $ssl_key_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cert_path = undef, + Optional[Stdlib::Absolutepath] $ssl_csr_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cacert_path = undef, + Boolean $accept_config = false, + Boolean $accept_commands = false, + Optional[String] $ca_host = undef, + Integer[1,65535] $ca_port = 5665, + String $ticket_salt = 'TicketSalt', + Hash $endpoints = { 'NodeName' => {} }, + Hash $zones = { 'ZoneName' => { endpoints => [ 'NodeName' ] } }, + Optional[String] $ssl_key = undef, + Optional[String] $ssl_cert = undef, + Optional[String] $ssl_cacert = undef, + Optional[String] $ssl_protocolmin = undef, + Optional[String] $ssl_cipher_list = undef, + Optional[String] $bind_host = undef, + Optional[Integer[1,65535]] $bind_port = undef, ) { if ! defined(Class['::icinga2']) { @@ -192,54 +192,24 @@ group => $group, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_re($pki, [ '^puppet$', '^none$', '^icinga2', '^ca' ], - "${pki} isn't supported. Valid values are 'puppet', 'none', 'icinga2' and 'ca (deprecated)'.") - validate_bool($accept_config) - validate_bool($accept_commands) - validate_string($ticket_salt) - validate_hash($endpoints) - validate_hash($zones) - - # Set defaults for certificate stuff and/or do validation + # Set defaults for certificate stuff if $ssl_key_path { - validate_absolute_path($ssl_key_path) $_ssl_key_path = $ssl_key_path } else { $_ssl_key_path = "${pki_dir}/${node_name}.key" } if $ssl_cert_path { - validate_absolute_path($ssl_cert_path) $_ssl_cert_path = $ssl_cert_path } else { $_ssl_cert_path = "${pki_dir}/${node_name}.crt" } if $ssl_csr_path { - validate_absolute_path($ssl_csr_path) $_ssl_csr_path = $ssl_csr_path } else { $_ssl_csr_path = "${pki_dir}/${node_name}.csr" } if $ssl_cacert_path { - validate_absolute_path($ssl_cacert_path) $_ssl_cacert_path = $ssl_cacert_path } else { $_ssl_cacert_path = "${pki_dir}/ca.crt" } - if $ssl_protocolmin { - validate_string($ssl_protocolmin) - } - if $ssl_cipher_list { - validate_string($ssl_cipher_list) - } - if $bind_host { - validate_string($bind_host) - } - if $bind_port { - validate_integer($bind_port) - } - - - # handle the certificate's stuff case $pki { 'puppet': { @@ -313,10 +283,6 @@ 'icinga2': { $_ticket_salt = undef - - validate_string($ca_host) - validate_integer($ca_port) - $ticket_id = icinga2_ticket_id($node_name, $ticket_salt) $trusted_cert = "${pki_dir}/trusted-cert.crt" diff --git a/manifests/feature/checker.pp b/manifests/feature/checker.pp index 0942719a5..83d53d3a0 100644 --- a/manifests/feature/checker.pp +++ b/manifests/feature/checker.pp @@ -12,8 +12,8 @@ # # class icinga2::feature::checker( - $ensure = present, - $concurrent_checks = undef, + Enum['absent', 'present'] $ensure = present, + Optional[Integer[1]] $concurrent_checks = undef, ) { if ! defined(Class['::icinga2']) { @@ -26,12 +26,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - - if $concurrent_checks { validate_integer($concurrent_checks) } - # compose attributes $attrs = { concurrent_checks => $concurrent_checks, diff --git a/manifests/feature/command.pp b/manifests/feature/command.pp index e4a59e019..241852136 100644 --- a/manifests/feature/command.pp +++ b/manifests/feature/command.pp @@ -13,8 +13,8 @@ # # class icinga2::feature::command( - $ensure = present, - $command_path = "${::icinga2::params::run_dir}/cmd/icinga2.cmd", + Enum['absent', 'present'] $ensure = present, + Stdlib::Absolutepath $command_path = "${::icinga2::params::run_dir}/cmd/icinga2.cmd", ) { if ! defined(Class['::icinga2']) { @@ -27,10 +27,6 @@ default => undef, } - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_absolute_path($command_path) - # compose attributes $attrs = { command_path => $command_path, diff --git a/manifests/feature/compatlog.pp b/manifests/feature/compatlog.pp index 9e6e0decf..7a0371171 100644 --- a/manifests/feature/compatlog.pp +++ b/manifests/feature/compatlog.pp @@ -17,9 +17,9 @@ # # class icinga2::feature::compatlog( - $ensure = present, - $log_dir = "${::icinga2::params::log_dir}/compat", - $rotation_method = 'DAILY', + Enum['absent', 'present'] $ensure = present, + Stdlib::Absolutepath $log_dir = "${::icinga2::params::log_dir}/compat", + Enum['DAILY', 'HOURLY', 'MONTHLY', 'WEEKLY'] $rotation_method = 'DAILY', ) { if ! defined(Class['::icinga2']) { @@ -32,12 +32,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_absolute_path($log_dir) - validate_re($rotation_method, ['^HOURLY$','^DAILY$','^WEEKLY$','^MONTHLY$']) - # compose attributes $attrs = { log_dir => $log_dir, diff --git a/manifests/feature/debuglog.pp b/manifests/feature/debuglog.pp index 2acd80558..b15d2eb16 100644 --- a/manifests/feature/debuglog.pp +++ b/manifests/feature/debuglog.pp @@ -14,8 +14,8 @@ # # class icinga2::feature::debuglog( - $ensure = present, - $path = "${::icinga2::params::log_dir}/debug.log", + Enum['absent', 'present'] $ensure = present, + Stdlib::Absolutepath $path = "${::icinga2::params::log_dir}/debug.log", ) { if ! defined(Class['::icinga2']) { @@ -28,11 +28,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_absolute_path($path) - # compose attributes $attrs = { severity => 'debug', diff --git a/manifests/feature/gelf.pp b/manifests/feature/gelf.pp index e7dbecdd1..cbad59517 100644 --- a/manifests/feature/gelf.pp +++ b/manifests/feature/gelf.pp @@ -21,11 +21,11 @@ # # class icinga2::feature::gelf( - $ensure = present, - $host = '127.0.0.1', - $port = '12201', - $source = 'icinga2', - $enable_send_perfdata = false, + Enum['absent', 'present'] $ensure = present, + String $host = '127.0.0.1', + Integer[1,65535] $port = 12201, + String $source = 'icinga2', + Boolean $enable_send_perfdata = false, ) { if ! defined(Class['::icinga2']) { @@ -38,14 +38,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($host) - validate_integer($port) - validate_string($source) - validate_bool($enable_send_perfdata) - # compose attributes $attrs = { host => $host, diff --git a/manifests/feature/graphite.pp b/manifests/feature/graphite.pp index d582345c9..1079299da 100644 --- a/manifests/feature/graphite.pp +++ b/manifests/feature/graphite.pp @@ -27,13 +27,13 @@ # # class icinga2::feature::graphite( - $ensure = present, - $host = '127.0.0.1', - $port = '2003', - $host_name_template = 'icinga2.$host.name$.host.$host.check_command$', - $service_name_template = 'icinga2.$host.name$.services.$service.name$.$service.check_command$', - $enable_send_thresholds = false, - $enable_send_metadata = false, + Enum['absent', 'present'] $ensure = present, + String $host = '127.0.0.1', + Integer[1,65535] $port = 2003, + String $host_name_template = 'icinga2.$host.name$.host.$host.check_command$', + String $service_name_template = 'icinga2.$host.name$.services.$service.name$.$service.check_command$', + Boolean $enable_send_thresholds = false, + Boolean $enable_send_metadata = false, ) { if ! defined(Class['::icinga2']) { @@ -46,16 +46,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($host) - validate_integer($port) - validate_string($host_name_template) - validate_string($service_name_template) - validate_bool($enable_send_thresholds) - validate_bool($enable_send_metadata) - # compose attributes $attrs = { host => $host, diff --git a/manifests/feature/idomysql.pp b/manifests/feature/idomysql.pp index 714975a00..63ed411f3 100644 --- a/manifests/feature/idomysql.pp +++ b/manifests/feature/idomysql.pp @@ -122,31 +122,31 @@ # # class icinga2::feature::idomysql( - $ensure = present, - $host = '127.0.0.1', - $port = 3306, - $socket_path = undef, - $user = 'icinga', - $password = 'icinga', - $database = 'icinga', - $enable_ssl = false, - $pki = 'puppet', - $ssl_key_path = undef, - $ssl_cert_path = undef, - $ssl_cacert_path = undef, - $ssl_key = undef, - $ssl_cert = undef, - $ssl_cacert = undef, - $ssl_capath = undef, - $ssl_cipher = undef, - $table_prefix = 'icinga_', - $instance_name = 'default', - $instance_description = undef, - $enable_ha = true, - $failover_timeout = '60s', - $cleanup = undef, - $categories = undef, - $import_schema = false, + Enum['absent', 'present'] $ensure = present, + String $host = '127.0.0.1', + Integer[1,65535] $port = 3306, + Optional[Stdlib::Absolutepath] $socket_path = undef, + String $user = 'icinga', + String $password = 'icinga', + String $database = 'icinga', + Boolean $enable_ssl = false, + Enum['none', 'puppet'] $pki = 'puppet', + Optional[Stdlib::Absolutepath] $ssl_key_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cert_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cacert_path = undef, + Optional[String] $ssl_key = undef, + Optional[String] $ssl_cert = undef, + Optional[String] $ssl_cacert = undef, + Optional[Stdlib::Absolutepath] $ssl_capath = undef, + Optional[String] $ssl_cipher = undef, + String $table_prefix = 'icinga_', + String $instance_name = 'default', + Optional[String] $instance_description = undef, + Boolean $enable_ha = true, + Pattern[/^\d+[ms]*$/] $failover_timeout = '60s', + Optional[Hash] $cleanup = undef, + Optional[Array] $categories = undef, + Boolean $import_schema = false, ) { if ! defined(Class['::icinga2']) { @@ -175,41 +175,16 @@ group => $group, } - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($host) - validate_integer($port) - if $socket_path { validate_absolute_path($socket_path) } - validate_string($user) - validate_string($password) - validate_string($database) - validate_bool($enable_ssl) - validate_re($pki, [ '^puppet$', '^none$' ], - "${pki} isn't supported. Valid values are 'puppet' and 'none'.") - validate_string($table_prefix) - validate_string($instance_name) - if $instance_description { validate_string($instance_description) } - validate_bool($enable_ha) - validate_re($failover_timeout, '^\d+[ms]*$') - if $cleanup { validate_hash($cleanup) } - if $categories { validate_array($categories) } - validate_bool($import_schema) - if $ssl_capath { validate_absolute_path($ssl_capath) } - if $ssl_cipher { validate_string($ssl_cipher) } - - # Set defaults for certificate stuff and/or do validation + # Set defaults for certificate stuff if $ssl_key_path { - validate_absolute_path($ssl_key_path) - $_ssl_key_path = $ssl_key_path } + $_ssl_key_path = $ssl_key_path} else { $_ssl_key_path = "${ssl_dir}/${node_name}.key" } if $ssl_cert_path { - validate_absolute_path($ssl_cert_path) $_ssl_cert_path = $ssl_cert_path } else { $_ssl_cert_path = "${ssl_dir}/${node_name}.crt" } if $ssl_cacert_path { - validate_absolute_path($ssl_cacert_path) $_ssl_cacert_path = $ssl_cacert_path } else { $_ssl_cacert_path = "${ssl_dir}/ca.crt" } diff --git a/manifests/feature/idopgsql.pp b/manifests/feature/idopgsql.pp index c5ecf86ae..046785d26 100644 --- a/manifests/feature/idopgsql.pp +++ b/manifests/feature/idopgsql.pp @@ -71,20 +71,20 @@ # # class icinga2::feature::idopgsql( - $ensure = present, - $host = '127.0.0.1', - $port = 5432, - $user = 'icinga', - $password = 'icinga', - $database = 'icinga', - $table_prefix = 'icinga_', - $instance_name = 'default', - $instance_description = undef, - $enable_ha = true, - $failover_timeout = '60s', - $cleanup = undef, - $categories = undef, - $import_schema = false, + Enum['absent', 'present'] $ensure = present, + String $host = '127.0.0.1', + Integer[1,65535] $port = 5432, + String $user = 'icinga', + String $password = 'icinga', + String $database = 'icinga', + String $table_prefix = 'icinga_', + String $instance_name = 'default', + Optional[String] $instance_description = undef, + Boolean $enable_ha = true, + Pattern[/^\d+[ms]*$/] $failover_timeout = '60s', + Optional[Hash] $cleanup = undef, + Optional[Array] $categories = undef, + Boolean $import_schema = false, ) { if ! defined(Class['::icinga2']) { @@ -100,22 +100,6 @@ default => undef, } - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($host) - validate_integer($port) - validate_string($user) - validate_string($password) - validate_string($database) - validate_string($table_prefix) - validate_string($instance_name) - if $instance_description { validate_string($instance_description) } - validate_bool($enable_ha) - validate_re($failover_timeout, '^\d+[ms]*$') - if $cleanup { validate_hash($cleanup) } - if $categories { validate_array($categories) } - validate_bool($import_schema) - $attrs = { host => $host, port => $port, diff --git a/manifests/feature/influxdb.pp b/manifests/feature/influxdb.pp index b479871dd..3ae58f1ab 100644 --- a/manifests/feature/influxdb.pp +++ b/manifests/feature/influxdb.pp @@ -97,28 +97,28 @@ # # class icinga2::feature::influxdb( - $ensure = present, - $host = '127.0.0.1', - $port = 8086, - $database = 'icinga2', - $username = undef, - $password = undef, - $enable_ssl = false, - $pki = 'puppet', - $ssl_key_path = undef, - $ssl_cert_path = undef, - $ssl_cacert_path = undef, - $ssl_key = undef, - $ssl_cert = undef, - $ssl_cacert = undef, - $host_measurement = '$host.check_command$', - $host_tags = { hostname => '$host.name$' }, - $service_measurement = '$service.check_command$', - $service_tags = { hostname => '$host.name$', service => '$service.name$' }, - $enable_send_thresholds = false, - $enable_send_metadata = false, - $flush_interval = '10s', - $flush_threshold = 1024 + Enum['absent', 'present'] $ensure = present, + String $host = '127.0.0.1', + Integer[1,65535] $port = 8086, + String $database = 'icinga2', + Optional[String] $username = undef, + Optional[String] $password = undef, + Boolean $enable_ssl = false, + Enum['none', 'puppet'] $pki = 'puppet', + Optional[Stdlib::Absolutepath] $ssl_key_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cert_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cacert_path = undef, + Optional[String] $ssl_key = undef, + Optional[String] $ssl_cert = undef, + Optional[String] $ssl_cacert = undef, + String $host_measurement = '$host.check_command$', + Hash $host_tags = { hostname => '$host.name$' }, + String $service_measurement = '$service.check_command$', + Hash $service_tags = { hostname => '$host.name$', service => '$service.name$' }, + Boolean $enable_send_thresholds = false, + Boolean $enable_send_metadata = false, + Pattern[/^\d+[ms]*$/] $flush_interval = '10s', + Integer[1] $flush_threshold = 1024 ) { if ! defined(Class['::icinga2']) { @@ -144,41 +144,19 @@ group => $group, } - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($host) - validate_integer($port) - validate_string($database) - validate_string($username) - validate_string($password) - validate_bool($enable_ssl) - validate_re($pki, [ '^puppet$', '^none$' ], - "${pki} isn't supported. Valid values are 'puppet' and 'none'.") - validate_string($host_measurement) - validate_hash($host_tags) - validate_string($service_measurement) - validate_hash($service_tags) - validate_bool($enable_send_thresholds) - validate_bool($enable_send_metadata) - validate_re($flush_interval, '^\d+[ms]*$') - validate_integer($flush_threshold) - $host_template = { measurement => $host_measurement, tags => $host_tags } $service_template = { measurement => $service_measurement, tags => $service_tags} - # Set defaults for certificate stuff and/or do validation + # Set defaults for certificate stuff if $ssl_key_path { - validate_absolute_path($ssl_key_path) $_ssl_key_path = $ssl_key_path } else { $_ssl_key_path = "${ssl_dir}/${node_name}.key" } if $ssl_cert_path { - validate_absolute_path($ssl_cert_path) $_ssl_cert_path = $ssl_cert_path } else { $_ssl_cert_path = "${ssl_dir}/${node_name}.crt" } if $ssl_cacert_path { - validate_absolute_path($ssl_cacert_path) $_ssl_cacert_path = $ssl_cacert_path } else { $_ssl_cacert_path = "${ssl_dir}/ca.crt" } diff --git a/manifests/feature/livestatus.pp b/manifests/feature/livestatus.pp index ecd5a4feb..c177e7264 100644 --- a/manifests/feature/livestatus.pp +++ b/manifests/feature/livestatus.pp @@ -31,12 +31,12 @@ # # class icinga2::feature::livestatus( - $ensure = present, - $socket_type = 'unix', - $bind_host = '127.0.0.1', - $bind_port = '6558', - $socket_path = "${::icinga2::params::run_dir}/cmd/livestatus", - $compat_log_path = "${::icinga2::params::log_dir}/compat", + Enum['absent', 'present'] $ensure = present, + Enum['tcp', 'unix'] $socket_type = 'unix', + String $bind_host = '127.0.0.1', + Integer[1,65535] $bind_port = 6558, + Stdlib::Absolutepath $socket_path = "${::icinga2::params::run_dir}/cmd/livestatus", + Stdlib::Absolutepath $compat_log_path = "${::icinga2::params::log_dir}/compat", ) { if ! defined(Class['::icinga2']) { @@ -49,16 +49,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_re($socket_type, [ '^unix$', '^tcp$' ], - "${socket_type} isn't supported. Valid values are 'unix' and 'tcp'.") - validate_string($bind_host) - validate_integer($bind_port) - validate_absolute_path($socket_path) - validate_absolute_path($compat_log_path) - # compose attributes $attrs = { socket_type => $socket_type, diff --git a/manifests/feature/mainlog.pp b/manifests/feature/mainlog.pp index a346ff1d7..15c94653a 100644 --- a/manifests/feature/mainlog.pp +++ b/manifests/feature/mainlog.pp @@ -16,9 +16,9 @@ # # class icinga2::feature::mainlog( - $ensure = present, - $severity = 'information', - $path = "${::icinga2::params::log_dir}/icinga2.log", + Enum['absent', 'present'] $ensure = present, + Enum['debug', 'information', 'notice', 'warning'] $severity = 'information', + Stdlib::Absolutepath $path = "${::icinga2::params::log_dir}/icinga2.log", ) { if ! defined(Class['::icinga2']) { @@ -31,12 +31,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_re($severity, ['^information$','^notice$','^warning$','^debug$']) - validate_absolute_path($path) - # compose attributes $attrs = { severity => $severity, diff --git a/manifests/feature/notification.pp b/manifests/feature/notification.pp index e44ef84b0..9e7255761 100644 --- a/manifests/feature/notification.pp +++ b/manifests/feature/notification.pp @@ -15,8 +15,8 @@ # # class icinga2::feature::notification( - $ensure = present, - $enable_ha = undef, + Enum['absent', 'present'] $ensure = present, + Optional[Boolean] $enable_ha = undef, ) { if ! defined(Class['::icinga2']) { @@ -29,13 +29,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - if $enable_ha { - validate_bool($enable_ha) - } - # compose attributes $attrs = { enable_ha => $enable_ha, diff --git a/manifests/feature/opentsdb.pp b/manifests/feature/opentsdb.pp index 41df623a3..0db2c727d 100644 --- a/manifests/feature/opentsdb.pp +++ b/manifests/feature/opentsdb.pp @@ -15,9 +15,9 @@ # # class icinga2::feature::opentsdb( - $ensure = present, - $host = '127.0.0.1', - $port = '4242', + Enum['absent', 'present'] $ensure = present, + String $host = '127.0.0.1', + Integer[1,65535] $port = 4242, ) { if ! defined(Class['::icinga2']) { @@ -30,12 +30,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($host) - validate_integer($port) - # compose attributes $attrs = { host => $host, diff --git a/manifests/feature/perfdata.pp b/manifests/feature/perfdata.pp index 05fe29d9d..e5916f90a 100644 --- a/manifests/feature/perfdata.pp +++ b/manifests/feature/perfdata.pp @@ -40,14 +40,14 @@ # # class icinga2::feature::perfdata( - $ensure = present, - $host_perfdata_path = "${::icinga2::params::spool_dir}/perfdata/host-perfdata", - $service_perfdata_path = "${::icinga2::params::spool_dir}/perfdata/service-perfdata", - $host_temp_path = "${::icinga2::params::spool_dir}/tmp/host-perfdata", - $service_temp_path = "${::icinga2::params::spool_dir}/tmp/service-perfdata", - $host_format_template = undef, - $service_format_template = undef, - $rotation_interval = '30s', + Enum['absent', 'present'] $ensure = present, + Stdlib::Absolutepath $host_perfdata_path = "${::icinga2::params::spool_dir}/perfdata/host-perfdata", + Stdlib::Absolutepath $service_perfdata_path = "${::icinga2::params::spool_dir}/perfdata/service-perfdata", + Stdlib::Absolutepath $host_temp_path = "${::icinga2::params::spool_dir}/tmp/host-perfdata", + Stdlib::Absolutepath $service_temp_path = "${::icinga2::params::spool_dir}/tmp/service-perfdata", + Optional[String] $host_format_template = undef, + Optional[String] $service_format_template = undef, + Pattern[/^\d+[ms]*$/] $rotation_interval = '30s', ) { if ! defined(Class['::icinga2']) { @@ -60,20 +60,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_absolute_path($host_perfdata_path) - validate_absolute_path($service_perfdata_path) - validate_absolute_path($host_temp_path) - validate_absolute_path($service_temp_path) - validate_re($rotation_interval, '^\d+[ms]*$') - if $host_format_template { validate_string($host_format_template) } - if $service_format_template { validate_string($service_format_template) } - - if $host_format_template { validate_string($host_format_template) } - if $service_format_template { validate_string($service_format_template) } - # compose attributes $attrs = { host_perfdata_path => $host_perfdata_path, diff --git a/manifests/feature/statusdata.pp b/manifests/feature/statusdata.pp index 005150c1e..102e80614 100644 --- a/manifests/feature/statusdata.pp +++ b/manifests/feature/statusdata.pp @@ -23,10 +23,10 @@ # # class icinga2::feature::statusdata( - $ensure = present, - $status_path = "${::icinga2::params::cache_dir}/status.dat", - $objects_path = "${::icinga2::params::cache_dir}/objects.cache", - $update_interval = '15s', + Enum['absent', 'present'] $ensure = present, + Stdlib::Absolutepath $status_path = "${::icinga2::params::cache_dir}/status.dat", + Stdlib::Absolutepath $objects_path = "${::icinga2::params::cache_dir}/objects.cache", + Pattern[/^\d+[ms]*$/] $update_interval = '15s', ) { if ! defined(Class['::icinga2']) { @@ -39,13 +39,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_absolute_path($status_path) - validate_absolute_path($objects_path) - validate_re($update_interval, '^\d+[ms]*$') - # compose attributes $attrs = { status_path => $status_path, diff --git a/manifests/feature/syslog.pp b/manifests/feature/syslog.pp index faca751ce..410899954 100644 --- a/manifests/feature/syslog.pp +++ b/manifests/feature/syslog.pp @@ -13,8 +13,8 @@ # # class icinga2::feature::syslog( - $ensure = present, - $severity = 'warning', + Enum['absent', 'present'] $ensure = present, + Enum['debug', 'information', 'notice', 'warning'] $severity = 'warning', ) { if ! defined(Class['::icinga2']) { @@ -27,11 +27,6 @@ default => undef, } - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_re($severity, ['^information$','^notice$','^warning$','^debug$']) - # compose attributes $attrs = { severity => $severity, diff --git a/manifests/init.pp b/manifests/init.pp index d004acf1e..b2c5998c7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -141,39 +141,25 @@ # } # # -class icinga2( - $ensure = running, - $enable = true, - $manage_repo = false, - $manage_package = true, - $manage_service = true, - $features = $icinga2::params::default_features, - $purge_features = true, - $constants = {}, - $plugins = $icinga2::params::plugins, - $confd = true, - $repositoryd = true, +class icinga2 ( + Enum['running', 'stopped'] $ensure = running, + Boolean $enable = true, + Boolean $manage_repo = false, + Boolean $manage_package = true, + Boolean $manage_service = true, + Array $features = $icinga2::params::default_features, + Boolean $purge_features = true, + Hash $constants = {}, + Array $plugins = $icinga2::params::plugins, + Variant[Boolean, String] $confd = true, + Boolean $repositoryd = true, ) inherits ::icinga2::params { - validate_re($ensure, [ '^running$', '^stopped$' ], - "${ensure} isn't supported. Valid values are 'running' and 'stopped'.") - validate_bool($enable) - validate_bool($manage_repo) - validate_bool($manage_package) - validate_bool($manage_service) - validate_array($features) - validate_bool($purge_features) - validate_hash($constants) - validate_array($plugins) - validate_bool($repositoryd) - # validate confd, boolean or string - if is_bool($confd) { + if $confd =~ Boolean { if $confd { $_confd = 'conf.d' } else { $_confd = undef } - } elsif is_string($confd) { - $_confd = $confd } else { - fail('confd has to be a boolean or string') + $_confd = $confd } # merge constants with defaults @@ -184,7 +170,7 @@ ~> Class['::icinga2::service'] anchor { '::icinga2::begin': - notify => Class['::icinga2::service'] + notify => Class['::icinga2::service'], } -> class { '::icinga2::repo': } -> class { '::icinga2::install': } @@ -193,7 +179,7 @@ -> File <| ensure != 'directory' and tag == 'icinga2::config::file' |> ~> class { '::icinga2::service': } -> anchor { '::icinga2::end': - subscribe => Class['::icinga2::config'] + subscribe => Class['::icinga2::config'], } include prefix($features, '::icinga2::feature::') diff --git a/manifests/object.pp b/manifests/object.pp index 8fced1297..7b74522ef 100644 --- a/manifests/object.pp +++ b/manifests/object.pp @@ -61,20 +61,20 @@ # # define icinga2::object( - $object_type, - $target, - $order, - $ensure = present, - $object_name = $title, - $template = false, - $apply = false, - $attrs_list = [], - $apply_target = undef, - $prefix = false, - $import = [], - $assign = [], - $ignore = [], - $attrs = {}, + String $object_type, + Stdlib::Absolutepath $target, + String $order, + Enum['present', 'absent'] $ensure = present, + String $object_name = $title, + Boolean $template = false, + Variant[Boolean, Pattern[/^.+\s+(=>\s+.+\s+)?in\s+.+$/]] $apply = false, + Array $attrs_list = [], + Optional[Enum['Host', 'Service']] $apply_target = undef, + Boolean $prefix = false, + Array $import = [], + Array $assign = [], + Array $ignore = [], + Hash $attrs = {}, ) { assert_private() @@ -98,23 +98,6 @@ } # default } - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($object_name) - validate_bool($template) - unless is_bool($apply) { validate_re($apply, '^.+\s+(=>\s+.+\s+)?in\s+.+$') } - validate_bool($prefix) - if $apply_target { validate_re($apply_target, ['^Host$', '^Service$'], - "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") } - validate_array($import) - validate_array($assign) - validate_array($ignore) - validate_hash($attrs) - validate_string($object_type) - validate_absolute_path($target) - validate_string($order) - validate_array($attrs_list) - if $object_type == $apply_target { fail('The object type must be different from the apply target') } diff --git a/manifests/object/apiuser.pp b/manifests/object/apiuser.pp index 14ba544fc..88accc155 100644 --- a/manifests/object/apiuser.pp +++ b/manifests/object/apiuser.pp @@ -46,28 +46,15 @@ # # define icinga2::object::apiuser( - $target, - $permissions, - $ensure = present, - $apiuser_name = $title, - $password = undef, - $client_cn = undef, - $order = '30', + Stdlib::Absolutepath $target, + Array $permissions, + Enum['absent', 'present'] $ensure = present, + String $apiuser_name = $title, + Optional[String] $password = undef, + Optional[String] $client_cn = undef, + Pattern[/^\d+$/] $order = '30', ) { - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_string($apiuser_name) - validate_string($order) - validate_absolute_path($target) - validate_array($permissions) - - if $password { validate_string($password) } - if $client_cn { validate_string($client_cn) } - # compose the attributes $attrs = { password => $password, diff --git a/manifests/object/checkcommand.pp b/manifests/object/checkcommand.pp index d9c06cdfc..bf6535815 100644 --- a/manifests/object/checkcommand.pp +++ b/manifests/object/checkcommand.pp @@ -40,37 +40,19 @@ # # define icinga2::object::checkcommand( - $target, - $ensure = present, - $checkcommand_name = $title, - $import = ['plugin-check-command'], - $command = undef, - $env = undef, - $vars = undef, - $timeout = undef, - $arguments = undef, - $template = false, - $order = '15', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + Optional[String] $checkcommand_name = $title, + Array $import = ['plugin-check-command'], + Optional[Variant[Array, String]] $command = undef, + Optional[Hash] $env = undef, + Optional[Hash] $vars = undef, + Optional[Integer[1]] $timeout = undef, + Optional[Hash] $arguments = undef, + Boolean $template = false, + Pattern[/^\d+$/] $order = '15', ) { - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_array($import) - validate_absolute_path($target) - validate_integer($order) - - if $checkcommand_name { validate_string($checkcommand_name) } - if !is_array($command) { validate_string($command) } - if !is_string($command) { validate_array($command) } - if $env { validate_hash($env) } - if $timeout { validate_integer($timeout) } - if $arguments { validate_hash($arguments) } - # compose the attributes $attrs = { command => $command, diff --git a/manifests/object/checkresultreader.pp b/manifests/object/checkresultreader.pp index 18dd6da2d..6c1dfa3fa 100644 --- a/manifests/object/checkresultreader.pp +++ b/manifests/object/checkresultreader.pp @@ -22,24 +22,12 @@ # # define icinga2::object::checkresultreader ( - $target, - $ensure = present, - $checkresultreader_name = $title, - $spool_dir = undef, - $order = '10', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $checkresultreader_name = $title, + Optional[Stdlib::Absolutepath] $spool_dir = undef, + Pattern[/^\d+$/] $order = '10', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($checkresultreader_name) - validate_absolute_path($target) - validate_string($order) - - if $spool_dir { validate_absolute_path($spool_dir) } # compose the attributes $attrs = { diff --git a/manifests/object/compatlogger.pp b/manifests/object/compatlogger.pp index 79330958c..762c5cf13 100644 --- a/manifests/object/compatlogger.pp +++ b/manifests/object/compatlogger.pp @@ -22,29 +22,13 @@ # # define icinga2::object::compatlogger ( - $target, - $ensure = present, - $compatlogger_name = $title, - $log_dir = undef, - $rotation_method = undef, - $order = '5', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $compatlogger_name = $title, + Optional[Stdlib::Absolutepath] $log_dir = undef, + Optional[Enum['DAILY', 'HOURLY', 'MONTHLY', 'WEEKLY']] $rotation_method = undef, + Pattern[/^\d+$/] $order = '5', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($compatlogger_name) - validate_absolute_path($target) - validate_string($order) - - if $log_dir { validate_absolute_path($log_dir) } - if $rotation_method { - validate_re($rotation_method, [ '^HOURLY$', '^DAILY$', '^WEEKLY$', '^MONTHLY$' ], - "${rotation_method} isn't supported. Valid values are 'HOURLY', 'DAILY', 'WEEKLY' and 'MONTHLY'.") - } # compose the attributes $attrs = { diff --git a/manifests/object/dependency.pp b/manifests/object/dependency.pp index f405bc959..da7b65b39 100644 --- a/manifests/object/dependency.pp +++ b/manifests/object/dependency.pp @@ -74,53 +74,27 @@ # # define icinga2::object::dependency ( - $target, - $ensure = present, - $dependency_name = $title, - $parent_host_name = undef, - $parent_service_name = undef, - $child_host_name = undef, - $child_service_name = undef, - $disable_checks = undef, - $disable_notifications = undef, - $ignore_soft_states = undef, - $period = undef, - $states = undef, - $apply = false, - $prefix = false, - $apply_target = 'Host', - $assign = [], - $ignore = [], - $import = [], - $template = false, - $order = '70', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $dependency_name = $title, + Optional[String] $parent_host_name = undef, + Optional[String] $parent_service_name = undef, + Optional[String] $child_host_name = undef, + Optional[String] $child_service_name = undef, + Optional[Boolean] $disable_checks = undef, + Optional[Boolean] $disable_notifications = undef, + Optional[Boolean] $ignore_soft_states = undef, + Optional[String] $period = undef, + Optional[Array] $states = undef, + Variant[Boolean, String] $apply = false, + Boolean $prefix = false, + Enum['Host', 'Service'] $apply_target = 'Host', + Array $assign = [], + Array $ignore = [], + Array $import = [], + Boolean $template = false, + Pattern[/^\d+$/] $order = '70', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($dependency_name) - unless is_bool($apply) { validate_string($apply) } - validate_bool($prefix) - validate_re($apply_target, ['^Host$', '^Service$'], - "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - if $parent_host_name { validate_string ($parent_host_name) } - if $parent_service_name { validate_string ( $parent_service_name ) } - if $child_host_name { validate_string ($child_host_name) } - if $child_service_name { validate_string ( $child_service_name ) } - if $disable_checks { validate_bool ( $disable_checks ) } - if $disable_notifications { validate_bool ( $disable_notifications ) } - if $ignore_soft_states { validate_bool ( $ignore_soft_states ) } - if $period { validate_string ( $period ) } - if $states { validate_array ( $states ) } # compose attributes $attrs = { diff --git a/manifests/object/endpoint.pp b/manifests/object/endpoint.pp index b9e49ad7d..75d6368c3 100644 --- a/manifests/object/endpoint.pp +++ b/manifests/object/endpoint.pp @@ -31,34 +31,24 @@ # # define icinga2::object::endpoint( - $ensure = present, - $endpoint_name = $title, - $host = undef, - $port = undef, - $log_duration = undef, - $target = undef, - $order = '40', + Enum['absent', 'present'] $ensure = present, + Optional[String] $endpoint_name = $title, + Optional[String] $host = undef, + Optional[Integer[1,65535]] $port = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $log_duration = undef, + Optional[Stdlib::Absolutepath] $target = undef, + Pattern[/^\d+$/] $order = '40', ) { include ::icinga2::params $conf_dir = $::icinga2::params::conf_dir - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_integer($order) - - if $endpoint_name { validate_string($endpoint_name) } - if $host { validate_string($host) } - if $port { validate_integer($port) } - if $log_duration { validate_re($log_duration, '^\d+\.?\d*[d|h|m|s]?$') } - if $target { - validate_absolute_path($target) - $_target = $target } - else { - $_target = "${conf_dir}/zones.conf" } + $_target = $target + } else { + $_target = "${conf_dir}/zones.conf" + } # compose the attributes $attrs = { diff --git a/manifests/object/eventcommand.pp b/manifests/object/eventcommand.pp index c2f293326..65e370658 100644 --- a/manifests/object/eventcommand.pp +++ b/manifests/object/eventcommand.pp @@ -44,34 +44,17 @@ # # define icinga2::object::eventcommand ( - $target, - $ensure = present, - $eventcommand_name = $title, - $command = undef, - $env = undef, - $vars = undef, - $timeout = undef, - $arguments = undef, - $import = ['plugin-event-command'], - $order = '20', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $eventcommand_name = $title, + Optional[Variant[Array,String]] $command = undef, + Optional[Hash] $env = undef, + Optional[Hash] $vars = undef, + Optional[Integer[1]] $timeout = undef, + Optional[Hash] $arguments = undef, + Array $import = ['plugin-event-command'], + Pattern[/^\d+$/] $order = '20', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($eventcommand_name) - validate_absolute_path($target) - validate_string($order) - validate_array($import) - - if !is_array($command) { validate_string($command) } - if !is_string($command) { validate_array($command) } - if $env { validate_hash($env) } - if $timeout { validate_integer($timeout) } - if $arguments { validate_hash($arguments) } # compose the attributes $attrs = { diff --git a/manifests/object/host.pp b/manifests/object/host.pp index a62b6da1a..802e6bfca 100644 --- a/manifests/object/host.pp +++ b/manifests/object/host.pp @@ -108,81 +108,41 @@ # # define icinga2::object::host( - $target, - $ensure = present, - $host_name = $title, - $import = [], - $address = undef, - $address6 = undef, - $vars = undef, - $groups = undef, - $display_name = undef, - $check_command = undef, - $max_check_attempts = undef, - $check_period = undef, - $check_timeout = undef, - $check_interval = undef, - $retry_interval = undef, - $enable_notifications = undef, - $enable_active_checks = undef, - $enable_passive_checks = undef, - $enable_event_handler = undef, - $enable_flapping = undef, - $enable_perfdata = undef, - $event_command = undef, - $flapping_threshold = undef, - $volatile = undef, - $zone = undef, - $command_endpoint = undef, - $notes = undef, - $notes_url = undef, - $action_url = undef, - $icon_image = undef, - $icon_image_alt = undef, - $template = false, - $order = '50', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + Optional[String] $host_name = $title, + Array $import = [], + Optional[String] $address = undef, + Optional[String] $address6 = undef, + Optional[Hash] $vars = undef, + Optional[Array] $groups = undef, + Optional[String] $display_name = undef, + Optional[String] $check_command = undef, + Optional[Integer[1]] $max_check_attempts = undef, + Optional[String] $check_period = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $check_timeout = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $check_interval = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $retry_interval = undef, + Optional[Boolean] $enable_notifications = undef, + Optional[Boolean] $enable_active_checks = undef, + Optional[Boolean] $enable_passive_checks = undef, + Optional[Boolean] $enable_event_handler = undef, + Optional[Boolean] $enable_flapping = undef, + Optional[Boolean] $enable_perfdata = undef, + Optional[String] $event_command = undef, + Optional[Integer[1]] $flapping_threshold = undef, + Optional[Boolean] $volatile = undef, + Optional[String] $zone = undef, + Optional[String] $command_endpoint = undef, + Optional[String] $notes = undef, + Optional[String] $notes_url = undef, + Optional[String] $action_url = undef, + Optional[Stdlib::Absolutepath] $icon_image = undef, + Optional[String] $icon_image_alt = undef, + Boolean $template = false, + Pattern[/^\d+$/] $order = '50', ) { - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_integer($order) - - if $host_name { validate_string($host_name) } - if $address { validate_string($address) } - if $address6 { validate_string($address6) } - if $groups { validate_array($groups) } - if $display_name { validate_string($display_name) } - if $check_command { validate_string($check_command) } - if $max_check_attempts { validate_integer($max_check_attempts) } - if $check_period { validate_string($check_period) } - if $check_timeout { validate_re($check_timeout, '^\d+\.?\d*[d|h|m|s]?$') } - if $check_interval { validate_re($check_interval, '^\d+\.?\d*[d|h|m|s]?$') } - if $retry_interval { validate_re($retry_interval, '^\d+\.?\d*[d|h|m|s]?$') } - if $enable_notifications { validate_bool($enable_notifications) } - if $enable_active_checks { validate_bool($enable_active_checks) } - if $enable_passive_checks { validate_bool($enable_passive_checks) } - if $enable_event_handler { validate_bool($enable_event_handler) } - if $enable_flapping { validate_bool($enable_flapping) } - if $enable_perfdata { validate_bool($enable_perfdata) } - if $event_command { validate_string($event_command) } - if $flapping_threshold { validate_integer($flapping_threshold) } - if $volatile { validate_bool($volatile) } - if $zone { validate_string($zone) } - if $command_endpoint { validate_string($command_endpoint) } - if $notes { validate_string($notes) } - if $notes_url { validate_string($notes_url) } - if $action_url { validate_string($action_url) } - if $icon_image { validate_absolute_path($icon_image) } - if $icon_image_alt { validate_string($icon_image_alt) } - # compose the attributes $attrs = { address => $address, diff --git a/manifests/object/hostgroup.pp b/manifests/object/hostgroup.pp index 9ee34738a..73863fe4b 100644 --- a/manifests/object/hostgroup.pp +++ b/manifests/object/hostgroup.pp @@ -34,28 +34,16 @@ # # define icinga2::object::hostgroup( - $target, - $ensure = present, - $hostgroup_name = $title, - $display_name = undef, - $groups = undef, - $assign = [], - $ignore = [], - $order = '55', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $hostgroup_name = $title, + Optional[String] $display_name = undef, + Optional[Array] $groups = undef, + Array $assign = [], + Array $ignore = [], + Pattern[/^\d+$/] $order = '55', ) { - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($hostgroup_name) - validate_array($assign) - validate_array($ignore) - validate_string($order) - validate_absolute_path($target) - - if $display_name { validate_string($display_name) } - if $groups { validate_array($groups) } - if $ignore != [] and $assign == [] { fail('When attribute ignore is used, assign must be set.') } diff --git a/manifests/object/notification.pp b/manifests/object/notification.pp index 2f4c400ef..2b655e1c3 100644 --- a/manifests/object/notification.pp +++ b/manifests/object/notification.pp @@ -79,64 +79,30 @@ # # define icinga2::object::notification ( - $target, - $ensure = present, - $notification_name = $title, - $host_name = undef, - $service_name = undef, - $vars = undef, - $users = undef, - $user_groups = undef, - $times = undef, - $command = undef, - $interval = undef, - $period = undef, - $zone = undef, - $types = undef, - $states = undef, - $apply = false, - $prefix = false, - $apply_target = 'Host', - $assign = [], - $ignore = [], - $import = [], - $template = false, - $order = '85', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $notification_name = $title, + Optional[String] $host_name = undef, + Optional[String] $service_name = undef, + Optional[Hash] $vars = undef, + Optional[Variant[Array, String]] $users = undef, + Optional[Variant[Array, String]] $user_groups = undef, + Optional[Hash] $times = undef, + Optional[String] $command = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $interval = undef, + Optional[String] $period = undef, + Optional[String] $zone = undef, + Optional[Variant[Array, String]] $types = undef, + Optional[Variant[Array, String]] $states = undef, + Variant[Boolean, String] $apply = false, + Boolean $prefix = false, + Enum['Host', 'Service'] $apply_target = 'Host', + Array $assign = [], + Array $ignore = [], + Array $import = [], + Boolean $template = false, + Pattern[/^\d+$/] $order = '85', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($notification_name) - unless is_bool($apply) { validate_string($apply) } - validate_bool($prefix) - validate_re($apply_target, ['^Host$', '^Service$'], - "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - validate_string ($host_name) - if $service_name { validate_string ($service_name)} - if !is_array($users) { validate_string($users) } - if !is_string($users) { validate_array($users) } - if !is_array($user_groups) { validate_string($user_groups) } - if !is_string($user_groups) { validate_array($user_groups) } - if $times { validate_hash ($times )} - if $command { validate_string ($command )} - if $interval { validate_re($interval, '^\d+(\.\d+)?[dhms]?$')} - if $period { validate_string ($period )} - if $zone { validate_string ($zone) } - if !is_array($types) { validate_string($types) } - if !is_string($types) { validate_array($types) } - if !is_array($states) { validate_string($states) } - if !is_string($states) { validate_array($states) } - if $assign { validate_array ($assign) } - if $ignore { validate_array ($ignore) } if $ignore != [] and $assign == [] { fail('When attribute ignore is used, assign must be set.') @@ -144,18 +110,18 @@ # compose attributes $attrs = { - 'host_name' => $host_name, + 'host_name' => $host_name, 'service_name' => $service_name, - 'users' => $users, - 'user_groups' => $user_groups, - 'times' => $times, - 'command' => $command, - 'interval' => $interval, - 'period' => $period, - 'zone' => $zone, - 'types' => $types, - 'states' => $states, - 'vars' => $vars, + 'users' => $users, + 'user_groups' => $user_groups, + 'times' => $times, + 'command' => $command, + 'interval' => $interval, + 'period' => $period, + 'zone' => $zone, + 'types' => $types, + 'states' => $states, + 'vars' => $vars, } # create object diff --git a/manifests/object/notificationcommand.pp b/manifests/object/notificationcommand.pp index 593827375..f61e671e5 100644 --- a/manifests/object/notificationcommand.pp +++ b/manifests/object/notificationcommand.pp @@ -49,36 +49,18 @@ # # define icinga2::object::notificationcommand ( - $target, - $ensure = present, - $notificationcommand_name = $title, - $command = undef, - $env = undef, - $vars = undef, - $timeout = undef, - $arguments = undef, - $template = false, - $import = ['plugin-notification-command'], - $order = '25', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $notificationcommand_name = $title, + Optional[Variant[Array, String]] $command = undef, + Optional[Hash] $env = undef, + Optional[Hash] $vars = undef, + Optional[Integer[1]] $timeout = undef, + Optional[Hash] $arguments = undef, + Boolean $template = false, + Array $import = ['plugin-notification-command'], + Pattern[/^\d+$/] $order = '25', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($notificationcommand_name) - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - if !is_array($command) { validate_string($command) } - if !is_string($command) { validate_array($command) } - if $env { validate_hash ($env) } - if $timeout { validate_integer ($timeout) } - if $arguments { validate_hash ($arguments) } # compose attributes $attrs = { diff --git a/manifests/object/scheduleddowntime.pp b/manifests/object/scheduleddowntime.pp index 8b05e41ae..b2827d10d 100644 --- a/manifests/object/scheduleddowntime.pp +++ b/manifests/object/scheduleddowntime.pp @@ -56,45 +56,23 @@ # # define icinga2::object::scheduleddowntime ( - $target, - $ensure = present, - $scheduleddowntime_name = $title, - $host_name = undef, - $service_name = undef, - $author = undef, - $comment = undef, - $fixed = undef, - $duration = undef, - $ranges = undef, - $apply = false, - $prefix = false, - $apply_target = 'Host', - $assign = [], - $ignore = [], - $order = '90', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $scheduleddowntime_name = $title, + Optional[String] $host_name = undef, + Optional[String] $service_name = undef, + Optional[String] $author = undef, + Optional[String] $comment = undef, + Optional[Boolean] $fixed = undef, + Optional[Pattern[/^\d+(\.\d+)?[dhms]?$/]] $duration = undef, + Optional[Hash] $ranges = undef, + Variant[Boolean, String] $apply = false, + Boolean $prefix = false, + Enum['Host', 'Service'] $apply_target = 'Host', + Array $assign = [], + Array $ignore = [], + Pattern[/^\d+$/] $order = '90', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($scheduleddowntime_name) - unless is_bool($apply) { validate_string($apply) } - validate_bool($prefix) - validate_re($apply_target, ['^Host$', '^Service$'], - "${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") - validate_absolute_path($target) - validate_string($order) - - if $host_name { validate_string($host_name) } - if $service_name { validate_string ($service_name) } - if $author { validate_string($author) } - if $comment { validate_string($comment) } - if $fixed { validate_bool($fixed) } - if $duration { validate_re($duration, '^\d+(\.\d+)?[dhms]?$') } - if $ranges { validate_hash($ranges) } # compose attributes $attrs = { diff --git a/manifests/object/service.pp b/manifests/object/service.pp index f7d9e3321..ec7e0f297 100644 --- a/manifests/object/service.pp +++ b/manifests/object/service.pp @@ -158,86 +158,44 @@ # define icinga2::object::service ( - $target, - $ensure = present, - $service_name = $title, - $display_name = undef, - $host_name = undef, - $groups = undef, - $vars = undef, - $check_command = undef, - $max_check_attempts = undef, - $check_period = undef, - $check_timeout = undef, - $check_interval = undef, - $retry_interval = undef, - $enable_notifications = undef, - $enable_active_checks = undef, - $enable_passive_checks = undef, - $enable_event_handler = undef, - $enable_flapping = undef, - $enable_perfdata = undef, - $event_command = undef, - $flapping_threshold = undef, - $volatile = undef, - $zone = undef, - $command_endpoint = undef, - $notes = undef, - $notes_url = undef, - $action_url = undef, - $icon_image = undef, - $icon_image_alt = undef, - $apply = false, - $prefix = false, - $assign = [], - $ignore = [], - $import = [], - $template = false, - $order = '60', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $service_name = $title, + Optional[String] $display_name = undef, + Optional[String] $host_name = undef, + Optional[Array] $groups = undef, + Optional[Hash] $vars = undef, + Optional[String] $check_command = undef, + Optional[Integer[1]] $max_check_attempts = undef, + Optional[String] $check_period = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $check_timeout = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $check_interval = undef, + Optional[Pattern[/^\d+\.?\d*[d|h|m|s]?$/]] $retry_interval = undef, + Optional[Boolean] $enable_notifications = undef, + Optional[Boolean] $enable_active_checks = undef, + Optional[Boolean] $enable_passive_checks = undef, + Optional[Boolean] $enable_event_handler = undef, + Optional[Boolean] $enable_flapping = undef, + Optional[Boolean] $enable_perfdata = undef, + Optional[String] $event_command = undef, + Optional[Integer[1]] $flapping_threshold = undef, + Optional[Boolean] $volatile = undef, + Optional[String] $zone = undef, + Optional[String] $command_endpoint = undef, + Optional[String] $notes = undef, + Optional[String] $notes_url = undef, + Optional[String] $action_url = undef, + Optional[Stdlib::Absolutepath] $icon_image = undef, + Optional[String] $icon_image_alt = undef, + Variant[Boolean, String] $apply = false, + Boolean $prefix = false, + Array $assign = [], + Array $ignore = [], + Array $import = [], + Boolean $template = false, + Pattern[/^\d+$/] $order = '60', ) { - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($service_name) - unless is_bool($apply) { validate_string($apply) } - validate_bool($prefix) - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - if $display_name { validate_string ($display_name) } - if $host_name { validate_string($host_name) } - if $groups { validate_array ($groups) } - if $check_command { validate_string($check_command) } - if $max_check_attempts { validate_integer ($max_check_attempts) } - if $check_period { validate_string ($check_period) } - if $check_timeout { validate_re($check_timeout, '^\d+\.?\d*[d|h|m|s]?$') } - if $check_interval { validate_re($check_interval, '^\d+\.?\d*[d|h|m|s]?$') } - if $retry_interval { validate_re($retry_interval, '^\d+\.?\d*[d|h|m|s]?$') } - if $enable_notifications { validate_bool ($enable_notifications) } - if $enable_active_checks { validate_bool ($enable_active_checks) } - if $enable_passive_checks { validate_bool ($enable_passive_checks) } - if $enable_event_handler { validate_bool ($enable_event_handler) } - if $enable_flapping { validate_bool ($enable_flapping) } - if $enable_perfdata { validate_bool ($enable_perfdata) } - if $event_command { validate_string ($event_command) } - if $flapping_threshold { validate_integer ($flapping_threshold) } - if $volatile { validate_bool ($volatile) } - if $zone { validate_string ($zone) } - if $command_endpoint { validate_string ($command_endpoint) } - if $notes { validate_string ($notes) } - if $notes_url { validate_string ($notes_url) } - if $action_url { validate_string ($action_url) } - if $icon_image { validate_absolute_path ($icon_image) } - if $icon_image_alt { validate_string ($icon_image_alt) } - - # compose the attributes $attrs = { 'display_name' => $display_name , diff --git a/manifests/object/servicegroup.pp b/manifests/object/servicegroup.pp index 2c81dc0b5..35dbef99c 100644 --- a/manifests/object/servicegroup.pp +++ b/manifests/object/servicegroup.pp @@ -37,33 +37,17 @@ # # define icinga2::object::servicegroup ( - $target, - $ensure = present, - $servicegroup_name = $title, - $display_name = undef, - $groups = undef, - $assign = [], - $ignore = [], - $template = false, - $import = [], - $order = '65', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $servicegroup_name = $title, + Optional[String] $display_name = undef, + Optional[Array] $groups = undef, + Array $assign = [], + Array $ignore = [], + Boolean $template = false, + Array $import = [], + Pattern[/^\d+$/] $order = '65', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($servicegroup_name) - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - if $display_name { validate_string ( $display_name ) } - if $groups { validate_array ( $groups ) } - # compose attributes $attrs = { diff --git a/manifests/object/timeperiod.pp b/manifests/object/timeperiod.pp index a8f606efd..6fa698413 100644 --- a/manifests/object/timeperiod.pp +++ b/manifests/object/timeperiod.pp @@ -40,37 +40,18 @@ # # define icinga2::object::timeperiod ( - $target, - $ensure = present, - $timeperiod_name = $title, - $display_name = undef, - $ranges = undef, - $prefer_includes = undef, - $excludes = undef, - $includes = undef, - $template = false, - $import = ['legacy-timeperiod'], - $order = '35', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $timeperiod_name = $title, + Optional[String] $display_name = undef, + Optional[Hash] $ranges = undef, + Optional[Boolean] $prefer_includes = undef, + Optional[Array] $excludes = undef, + Optional[Array] $includes = undef, + Boolean $template = false, + Array $import = ['legacy-timeperiod'], + Pattern[/^\d+$/] $order = '35', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($timeperiod_name) - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - - if $display_name { validate_string ($display_name) } - if $ranges { validate_hash ($ranges) } - if $prefer_includes { validate_bool ($prefer_includes) } - if $excludes { validate_array ($excludes) } - if $includes { validate_array ($includes) } # compose attributes $attrs = { diff --git a/manifests/object/user.pp b/manifests/object/user.pp index 004a97d1a..a811889f3 100644 --- a/manifests/object/user.pp +++ b/manifests/object/user.pp @@ -56,45 +56,22 @@ # # define icinga2::object::user ( - $target, - $ensure = present, - $user_name = $title, - $display_name = undef, - $email = undef, - $pager = undef, - $vars = undef, - $groups = undef, - $enable_notifications = undef, - $period = undef, - $types = undef, - $states = undef, - $import = [], - $template = false, - $order = '75', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $user_name = $title, + Optional[String] $display_name = undef, + Optional[String] $email = undef, + Optional[String] $pager = undef, + Optional[Hash] $vars = undef, + Optional[Array] $groups = undef, + Optional[Boolean] $enable_notifications = undef, + Optional[String] $period = undef, + Optional[Array] $types = undef, + Optional[Array] $states = undef, + Array $import = [], + Boolean $template = false, + Pattern[/^\d+$/] $order = '75', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($user_name) - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - if $display_name { validate_string ($display_name) } - if $email { validate_string ($email) } - if $pager { validate_string ($pager) } - if $groups { validate_array ($groups) } - if $enable_notifications { validate_bool ($enable_notifications) } - if $period { validate_string ($period) } - if $types { validate_array ($types) } - if $states { validate_array ($states) } - - validate_integer ( $order ) # compose attributes $attrs = { diff --git a/manifests/object/usergroup.pp b/manifests/object/usergroup.pp index d13ae0d27..821f9dac5 100644 --- a/manifests/object/usergroup.pp +++ b/manifests/object/usergroup.pp @@ -37,32 +37,17 @@ # # define icinga2::object::usergroup ( - $target, - $ensure = present, - $usergroup_name = $title, - $display_name = undef, - $groups = [], - $assign = [], - $ignore = [], - $import = [], - $template = false, - $order = '80', + Stdlib::Absolutepath $target, + Enum['absent', 'present'] $ensure = present, + String $usergroup_name = $title, + Optional[String] $display_name = undef, + Array $groups = [], + Array $assign = [], + Array $ignore = [], + Array $import = [], + Boolean $template = false, + Pattern[/^\d+$/] $order = '80', ){ - include ::icinga2::params - - $conf_dir = $::icinga2::params::conf_dir - - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($usergroup_name) - validate_array($import) - validate_bool($template) - validate_absolute_path($target) - validate_string($order) - - if $display_name { validate_string ($display_name) } - if $groups { validate_array ($groups) } if $ignore != [] and $assign == [] { fail('When attribute ignore is used, assign must be set.') diff --git a/manifests/object/zone.pp b/manifests/object/zone.pp index 47982b089..de22f45e7 100644 --- a/manifests/object/zone.pp +++ b/manifests/object/zone.pp @@ -29,37 +29,25 @@ # # define icinga2::object::zone( - $ensure = present, - $zone_name = $title, - $endpoints = [], - $parent = undef, - $global = false, - $target = undef, - $order = '45', + Enum['absent', 'present'] $ensure = present, + String $zone_name = $title, + Optional[Array] $endpoints = [], + Optional[String] $parent = undef, + Optional[Boolean] $global = false, + Optional[Stdlib::Absolutepath] $target = undef, + Pattern[/^\d+$/] $order = '45', ) { include ::icinga2::params $conf_dir = $::icinga2::params::conf_dir - # validation - validate_re($ensure, [ '^present$', '^absent$' ], - "${ensure} isn't supported. Valid values are 'present' and 'absent'.") - validate_string($zone_name) - validate_integer($order) - - if $endpoints { validate_array($endpoints) } - if $parent { validate_string($parent) } - if $global { validate_bool($global) } - - # set defaults and validate + # set defaults if $target { - validate_absolute_path($target) - $_target = $target } - else { - $_target = "${conf_dir}/zones.conf" } - - validate_string($order) + $_target = $target + } else { + $_target = "${conf_dir}/zones.conf" + } # compose the attributes if $global { diff --git a/manifests/pki/ca.pp b/manifests/pki/ca.pp index cf4c3f498..ecf824382 100644 --- a/manifests/pki/ca.pp +++ b/manifests/pki/ca.pp @@ -53,12 +53,12 @@ # # class icinga2::pki::ca( - $ca_cert = undef, - $ca_key = undef, - $ssl_key_path = undef, - $ssl_cert_path = undef, - $ssl_csr_path = undef, - $ssl_cacert_path = undef, + Optional[String] $ca_cert = undef, + Optional[String] $ca_key = undef, + Optional[Stdlib::Absolutepath] $ssl_key_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cert_path = undef, + Optional[Stdlib::Absolutepath] $ssl_csr_path = undef, + Optional[Stdlib::Absolutepath] $ssl_cacert_path = undef, ) { include ::icinga2::params @@ -81,22 +81,18 @@ } if $ssl_key_path { - validate_absolute_path($ssl_key_path) $_ssl_key_path = $ssl_key_path } else { $_ssl_key_path = "${pki_dir}/${node_name}.key" } if $ssl_cert_path { - validate_absolute_path($ssl_cert_path) $_ssl_cert_path = $ssl_cert_path } else { $_ssl_cert_path = "${pki_dir}/${node_name}.crt" } if $ssl_csr_path { - validate_absolute_path($ssl_csr_path) $_ssl_csr_path = $ssl_csr_path } else { $_ssl_csr_path = "${pki_dir}/${node_name}.csr" } if $ssl_cacert_path { - validate_absolute_path($ssl_cacert_path) $_ssl_cacert_path = $ssl_cacert_path } else { $_ssl_cacert_path = "${pki_dir}/ca.crt" } @@ -114,9 +110,6 @@ notify => Class['::icinga2::service'], } } else { - validate_string($ca_cert) - validate_string($ca_key) - if $::osfamily == 'windows' { $_ca_dir_mode = undef $_ca_cert = regsubst($ca_cert, '\n', "\r\n", 'EMG') @@ -157,7 +150,7 @@ exec { 'icinga2 pki create certificate signing request': command => "icinga2 pki new-cert --cn '${node_name}' --key '${_ssl_key_path}' --csr '${_ssl_csr_path}'", creates => $_ssl_key_path, - require => File[$_ssl_cacert_path] + require => File[$_ssl_cacert_path], } -> file { $_ssl_key_path: diff --git a/manifests/repo.pp b/manifests/repo.pp index a44483ceb..d181f1e98 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -76,7 +76,7 @@ 'suse': { file { '/etc/pki/GPG-KEY-icinga': - ensure => present, + ensure => file, source => 'http://packages.icinga.com/icinga.key', } @@ -94,7 +94,7 @@ baseurl => "http://packages.icinga.com/SUSE/${::operatingsystemrelease}/release/", enabled => 1, gpgcheck => 1, - require => Exec['import icinga gpg key'] + require => Exec['import icinga gpg key'], } } default: { diff --git a/spec/classes/api_spec.rb b/spec/classes/api_spec.rb index 55fc3661d..6963a6e18 100644 --- a/spec/classes/api_spec.rb +++ b/spec/classes/api_spec.rb @@ -87,7 +87,7 @@ context "#{os} with pki => foo (not a valid value)" do let(:params) { {:pki => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['ca', 'icinga2', 'none', 'puppet'\]/) } end @@ -118,7 +118,8 @@ context "#{os} with ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -134,7 +135,7 @@ context "#{os} with ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -150,7 +151,7 @@ context "#{os} with ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -175,7 +176,7 @@ context "#{os} with accept_config => foo (not a valid boolean)" do let(:params) { {:accept_config => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -200,7 +201,7 @@ context "#{os} with accept_commands => foo (not a valid boolean)" do let(:params) { {:accept_commands => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -213,7 +214,7 @@ context "#{os} with pki => 'icinga2', ca_port => 1234" do - let(:params) { {:pki => 'icinga2',:ca_port => '1234'} } + let(:params) { {:pki => 'icinga2',:ca_port => 1234} } it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api') .with({ 'target' => '/etc/icinga2/features-available/api.conf' }) } @@ -223,7 +224,7 @@ context "#{os} with pki => 'icinga2', ca_port => foo (not a valid integer)" do let(:params) { {:pki => 'icinga2',:ca_port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -246,7 +247,7 @@ context "#{os} with endpoints => foo (not a valid hash)" do let(:params) { {:endpoints => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end @@ -261,7 +262,7 @@ context "#{os} with zones => foo (not a valid hash)" do let(:params) { {:zones => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end context "#{os} with TLS detail settings" do @@ -380,7 +381,7 @@ context "Windows 2012 R2 with pki => foo (not a valid value)" do let(:params) { {:pki => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['ca', 'icinga2', 'none', 'puppet'\]/) } end @@ -410,7 +411,7 @@ context "Windows 2012 R2 with ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -426,7 +427,7 @@ context "Windows 2012 R2 with ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -442,7 +443,7 @@ context "Windows 2012 R2 with ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -467,7 +468,7 @@ context "Windows 2012 R2 with accept_config => foo (not a valid boolean)" do let(:params) { {:accept_config => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -492,7 +493,7 @@ context "Windows 2012 R2 with accept_config => foo (not a valid boolean)" do let(:params) { {:accept_commands => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -514,7 +515,7 @@ context "Windows 2012 R2 with pki => 'icinga2', ca_port => 1234" do - let(:params) { {:pki => 'icinga2',:ca_port => '1234'} } + let(:params) { {:pki => 'icinga2',:ca_port => 1234} } it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api') .with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' }) } @@ -524,7 +525,7 @@ context "Windows 2012 R2 with pki => 'icinga2', ca_port => foo (not a valid integer)" do let(:params) { {:pki => 'icinga2',:ca_port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -538,7 +539,7 @@ context "Windows 2012 R2 with endpoints => foo (not a valid hash)" do let(:params) { {:endpoints => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end @@ -553,7 +554,7 @@ context "Windows 2012 R2 with zones => foo (not a valid hash)" do let(:params) { {:zones => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end context 'Windows 2012 R2 with bind settings' do diff --git a/spec/classes/ca_spec.rb b/spec/classes/ca_spec.rb index 7dc73d4a7..87f64bcf1 100644 --- a/spec/classes/ca_spec.rb +++ b/spec/classes/ca_spec.rb @@ -41,7 +41,7 @@ context "#{os} with ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -55,7 +55,7 @@ context "#{os} with ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -69,7 +69,7 @@ context "#{os} with ssl_csr_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_csr_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -83,7 +83,7 @@ context "#{os} with ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end end @@ -142,7 +142,7 @@ context "Windows 2012 R2 with ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -156,7 +156,7 @@ context "Windows 2012 R2 with ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -170,7 +170,7 @@ context "Windows 2012 R2 with ssl_csr_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_csr_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -184,7 +184,7 @@ context "Windows 2012 R2 with ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end diff --git a/spec/classes/checker_spec.rb b/spec/classes/checker_spec.rb index 7f6bff1c6..1058add69 100644 --- a/spec/classes/checker_spec.rb +++ b/spec/classes/checker_spec.rb @@ -43,7 +43,7 @@ context "#{os} with concurrent_checks => foo (not a valid integer)" do let(:params) { {:concurrent_checks => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end end @@ -105,6 +105,6 @@ context "Windows 2012 R2 with concurrent_checks => foo (not a valid integer)" do let(:params) { {:concurrent_checks => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end -end \ No newline at end of file +end diff --git a/spec/classes/command_spec.rb b/spec/classes/command_spec.rb index 3594a933e..82c5c765d 100644 --- a/spec/classes/command_spec.rb +++ b/spec/classes/command_spec.rb @@ -52,7 +52,7 @@ context "#{os} with command_path => foo/bar (not an absolute path)" do let(:params) { {:command_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end end @@ -123,6 +123,6 @@ context 'Windows 2012 R2 with path => foo/bar (not an absolute path)' do let(:params) { {:command_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end -end \ No newline at end of file +end diff --git a/spec/classes/compatlog_spec.rb b/spec/classes/compatlog_spec.rb index 117f5edb8..ec76e1372 100644 --- a/spec/classes/compatlog_spec.rb +++ b/spec/classes/compatlog_spec.rb @@ -53,7 +53,7 @@ context "#{os} with rotation_method => foo (not a valid value)" do let(:params) { {:rotation_method => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['DAILY', 'HOURLY', 'MONTHLY', 'WEEKLY'\]/) } end @@ -69,7 +69,7 @@ context "#{os} with log_dir => foo/bar (not an absolute path)" do let(:params) { {:log_dir => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end end @@ -141,7 +141,7 @@ context 'Windows 2012 R2 with rotation_method => foo (not a valid value)' do let(:params) { {:rotation_method => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['DAILY', 'HOURLY', 'MONTHLY', 'WEEKLY'\]/) } end @@ -157,7 +157,7 @@ context 'Windows 2012 R2 with path => foo/bar (not an absolute path)' do let(:params) { {:log_dir => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end -end \ No newline at end of file +end diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 8d65b3736..6ee73ad47 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -22,7 +22,7 @@ context "#{os} with constants => foo (not a valid hash)" do let(:params) { {:constants => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end diff --git a/spec/classes/debuglog_spec.rb b/spec/classes/debuglog_spec.rb index e2436cebd..00a79a6ac 100644 --- a/spec/classes/debuglog_spec.rb +++ b/spec/classes/debuglog_spec.rb @@ -53,7 +53,7 @@ context "#{os} with path => foo/bar (not an absolute path)" do let(:params) { {:path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end end @@ -124,6 +124,6 @@ context 'Windows 2012 R2 with path => foo/bar (not an absolute path)' do let(:params) { {:path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end diff --git a/spec/classes/gelf_spec.rb b/spec/classes/gelf_spec.rb index d0bc7762b..621d48d53 100644 --- a/spec/classes/gelf_spec.rb +++ b/spec/classes/gelf_spec.rb @@ -53,7 +53,7 @@ context "#{os} with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::GelfWriter::gelf') .with({ 'target' => '/etc/icinga2/features-available/gelf.conf' }) @@ -64,7 +64,7 @@ context "#{os} with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -98,7 +98,7 @@ context "#{os} with enable_send_perfdata => foo (not a valid boolean)" do let(:params) { {:enable_send_perfdata => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end end end @@ -170,7 +170,7 @@ context "Windows 2012 R2 with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::GelfWriter::gelf') .with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/gelf.conf' }) @@ -208,6 +208,6 @@ context "Windows 2012 R2 with enable_send_perfdata => foo (not a valid boolean)" do let(:params) { {:enable_send_perfdata => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end end diff --git a/spec/classes/graphite_spec.rb b/spec/classes/graphite_spec.rb index e28b0b4d9..15635becd 100644 --- a/spec/classes/graphite_spec.rb +++ b/spec/classes/graphite_spec.rb @@ -56,7 +56,7 @@ context "#{os} with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::GraphiteWriter::graphite') .with({ 'target' => '/etc/icinga2/features-available/graphite.conf' }) @@ -67,7 +67,7 @@ context "#{os} with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -110,7 +110,7 @@ context "#{os} with enable_send_thresholds => foo (not a valid boolean)" do let(:params) { {:enable_send_thresholds => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -135,7 +135,7 @@ context "#{os} with enable_send_metadata => foo (not a valid boolean)" do let(:params) { {:enable_send_metadata => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end end end @@ -209,7 +209,7 @@ context "Windows 2012 R2 with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::GraphiteWriter::graphite') .with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/graphite.conf' }) @@ -220,7 +220,7 @@ context "Windows 2012 R2 with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -263,7 +263,7 @@ context "Windows 2012 R2 with enable_send_thresholds => foo (not a valid boolean)" do let(:params) { {:enable_send_thresholds => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -288,6 +288,6 @@ context "Windows 2012 R2 with enable_send_metadata => foo (not a valid boolean)" do let(:params) { {:enable_send_metadata => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end end diff --git a/spec/classes/idomysql_spec.rb b/spec/classes/idomysql_spec.rb index 89ac198f2..194c0d7b0 100644 --- a/spec/classes/idomysql_spec.rb +++ b/spec/classes/idomysql_spec.rb @@ -55,7 +55,7 @@ context "#{os} with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::IdoMysqlConnection::ido-mysql') .with({ 'target' => '/etc/icinga2/features-available/ido-mysql.conf' }) @@ -66,7 +66,7 @@ context "#{os} with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -82,7 +82,7 @@ context "#{os} with socket_path => foo/bar (not an absolute path)" do let(:params) { {:socket_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -128,7 +128,7 @@ context "#{os} with pki => foo (not a valid value)" do let(:params) { {:pki => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /Valid values are 'puppet' and 'none'/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['none', 'puppet'\]/) } end @@ -159,7 +159,7 @@ context "#{os} with enable_ssl = true, ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -175,7 +175,7 @@ context "#{os} with enable_ssl = true, ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -191,7 +191,7 @@ context "#{os} with enable_ssl = true, ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -218,7 +218,7 @@ context "#{os} with enabl_ssl = true, pki = none, ssl_capath = foo" do let(:params) { {:enable_ssl => true,:pki => 'none', :ssl_capath => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -261,7 +261,7 @@ context "#{os} with enable_ha => foo (not a valid boolean)" do let(:params) { {:enable_ha => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -277,7 +277,7 @@ context "#{os} with failover_timeout => foo (not a valid value)" do let(:params) { {:failover_timeout => "foo"} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -293,7 +293,7 @@ context "#{os} with cleanup => 'foo' (not a valid hash)" do let(:params) { {:cleanup => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -309,7 +309,7 @@ context "#{os} with categories => 'foo' (not a valid array)" do let(:params) { {:categories => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -330,7 +330,7 @@ context "#{os} with import_schema => foo (not a valid boolean)" do let(:params) { {:import_schema => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -412,7 +412,7 @@ context "Windows 2012 R2 with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::IdoMysqlConnection::ido-mysql') @@ -424,7 +424,7 @@ context "Windows 2012 R2 with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -440,7 +440,7 @@ context "Windows 2012 R2 with socket_path => foo/bar (not an absolute path)" do let(:params) { {:socket_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -486,7 +486,7 @@ context "Windows 2012 R2 with pki => foo (not a valid value)" do let(:params) { {:pki => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /Valid values are 'puppet' and 'none'/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['none', 'puppet'\]/) } end @@ -515,7 +515,7 @@ context "Windows 2012 R2 with enable_ssl = true, ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -531,7 +531,7 @@ context "Windows 2012 R2 with enable_ssl = true, ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -547,7 +547,7 @@ context "Windows 2012 R2 with enable_ssl = true, ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -574,7 +574,7 @@ context "Windows 2012 R2 with enabl_ssl = true, pki = none, ssl_capath = foo" do let(:params) { {:enable_ssl => true,:pki => 'none', :ssl_capath => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -617,7 +617,7 @@ context "Windows 2012 R2 with enable_ha => foo (not a valid boolean)" do let(:params) { {:enable_ha => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -633,7 +633,7 @@ context "Windows 2012 R2 with failover_timeout => foo (not a valid value)" do let(:params) { {:failover_timeout => "foo"} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -649,7 +649,7 @@ context "Windows 2012 R2 with cleanup => 'foo' (not a valid hash)" do let(:params) { {:cleanup => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -665,7 +665,7 @@ context "Windows 2012 R2 with categories => 'foo' (not a valid array)" do let(:params) { {:categories => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -686,7 +686,7 @@ context "Windows 2012 R2 with import_schema => foo (not a valid boolean)" do let(:params) { {:import_schema => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end context "Windows 2012 R2 with icinga2::manage_package => true" do diff --git a/spec/classes/idopgsql_spec.rb b/spec/classes/idopgsql_spec.rb index a396a42df..518ead8c9 100644 --- a/spec/classes/idopgsql_spec.rb +++ b/spec/classes/idopgsql_spec.rb @@ -50,7 +50,7 @@ context "#{os} with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::IdoPgsqlConnection::ido-pgsql') .with({ 'target' => '/etc/icinga2/features-available/ido-pgsql.conf' }) @@ -61,7 +61,7 @@ context "#{os} with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -122,7 +122,7 @@ context "#{os} with enable_ha => foo (not a valid boolean)" do let(:params) { {:enable_ha => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -138,7 +138,7 @@ context "#{os} with failover_timeout => foo (not a valid value)" do let(:params) { {:failover_timeout => "foo"} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -154,7 +154,7 @@ context "#{os} with cleanup => 'foo' (not a valid hash)" do let(:params) { {:cleanup => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -170,7 +170,7 @@ context "#{os} with categories => 'foo' (not a valid array)" do let(:params) { {:categories => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -191,7 +191,7 @@ context "#{os} with import_schema => foo (not a valid boolean)" do let(:params) { {:import_schema => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end context "#{os} with icinga2::manage_package => true" do @@ -266,7 +266,7 @@ context "Windows 2012 R2 with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::IdoPgsqlConnection::ido-pgsql') .with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/ido-pgsql.conf' }) @@ -277,7 +277,7 @@ context "Windows 2012 R2 with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -338,7 +338,7 @@ context "Windows 2012 R2 with enable_ha => foo (not a valid boolean)" do let(:params) { {:enable_ha => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -354,7 +354,7 @@ context "Windows 2012 R2 with failover_timeout => foo (not a valid value)" do let(:params) { {:failover_timeout => "foo"} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -370,7 +370,7 @@ context "Windows 2012 R2 with cleanup => 'foo' (not a valid hash)" do let(:params) { {:cleanup => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -386,7 +386,7 @@ context "Windows 2012 R2 with categories => 'foo' (not a valid array)" do let(:params) { {:categories => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -407,7 +407,7 @@ context "Windows 2012 R2 with import_schema => foo (not a valid boolean)" do let(:params) { {:import_schema => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end context "Windows 2012 R2 with icinga2::manage_package => true" do diff --git a/spec/classes/influxdb_spec.rb b/spec/classes/influxdb_spec.rb index c867b1fe9..cdcf5e8a9 100644 --- a/spec/classes/influxdb_spec.rb +++ b/spec/classes/influxdb_spec.rb @@ -70,7 +70,7 @@ context "#{os} with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -126,7 +126,7 @@ context "#{os} with pki => foo (not a valid value)" do let(:params) { {:pki => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /Valid values are 'puppet' and 'none'/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['none', 'puppet'\]/) } end @@ -157,7 +157,7 @@ context "#{os} with enable_ssl = true, ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -173,7 +173,7 @@ context "#{os} with enable_ssl = true, ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -189,7 +189,7 @@ context "#{os} with enable_ssl = true, ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -214,7 +214,7 @@ context "#{os} with host_tags => 'foo' (not a valid hash)" do let(:params) { {:host_tags => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end @@ -239,7 +239,7 @@ context "#{os} with service_tags => 'foo' (not a valid hash)" do let(:params) { {:service_tags => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end @@ -264,7 +264,7 @@ context "#{os} with enable_send_thresholds => foo (not a valid boolean)" do let(:params) { {:enable_send_thresholds => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -289,7 +289,7 @@ context "#{os} with enable_send_metadata => foo (not a valid boolean)" do let(:params) { {:enable_send_metadata => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end context "#{os} with flush_interval => 50s" do @@ -304,12 +304,12 @@ context "#{os} with flush_interval => foo (not a valid value)" do let(:params) { {:flush_interval => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end context "#{os} with flush_threshold => 2048" do - let(:params) { {:flush_threshold => '2048'} } + let(:params) { {:flush_threshold => 2048} } it { is_expected.to contain_concat__fragment('icinga2::object::InfluxdbWriter::influxdb') .with({ 'target' => '/etc/icinga2/features-available/influxdb.conf' }) @@ -320,7 +320,7 @@ context "#{os} with flush_threshold => foo (not a valid integer)" do let(:params) { {:flush_threshold => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end end end @@ -409,7 +409,7 @@ context "Windows 2012 R2 with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -465,7 +465,7 @@ context "Windows 2012 R2 with pki => foo (not a valid value)" do let(:params) { {:pki => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /Valid values are 'puppet' and 'none'/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['none', 'puppet'\]/) } end @@ -495,7 +495,7 @@ context "Windows 2012 R2 with enable_ssl = true, ssl_key_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_key_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -511,7 +511,7 @@ context "Windows 2012 R2 with enable_ssl = true, ssl_cert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -527,7 +527,7 @@ context "Windows 2012 R2 with enable_ssl = true, ssl_cacert_path = foo/bar (not a valid absolute path)" do let(:params) { {:enable_ssl => true, :ssl_cacert_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -552,7 +552,7 @@ context "Windows 2012 R2 with host_tags => 'foo' (not a valid hash)" do let(:params) { {:host_tags => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end @@ -577,7 +577,7 @@ context "Windows 2012 R2 with service_tags => 'foo' (not a valid hash)" do let(:params) { {:service_tags => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) } end @@ -602,7 +602,7 @@ context "Windows 2012 R2 with enable_send_thresholds => foo (not a valid boolean)" do let(:params) { {:enable_send_thresholds => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -627,7 +627,7 @@ context "Windows 2012 R2 with enable_send_metadata => foo (not a valid boolean)" do let(:params) { {:enable_send_metadata => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end context "Windows 2012 R2 with flush_interval => 50s" do @@ -642,12 +642,12 @@ context "Windows 2012 R2 with flush_interval => foo (not a valid value)" do let(:params) { {:flush_interval => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end context "Windows 2012 R2 with flush_threshold => 2048" do - let(:params) { {:flush_threshold => '2048'} } + let(:params) { {:flush_threshold => 2048} } it { is_expected.to contain_concat__fragment('icinga2::object::InfluxdbWriter::influxdb') .with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/influxdb.conf' }) @@ -658,7 +658,7 @@ context "Windows 2012 R2 with flush_threshold => foo (not a valid integer)" do let(:params) { {:flush_threshold => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end end diff --git a/spec/classes/livestatus_spec.rb b/spec/classes/livestatus_spec.rb index 08e660d1e..d2b4a8b70 100644 --- a/spec/classes/livestatus_spec.rb +++ b/spec/classes/livestatus_spec.rb @@ -57,7 +57,7 @@ context "#{os} with socket_type => foo (not a valid value)" do let(:params) { {:socket_type => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported. Valid values are 'unix' and 'tcp'./) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['tcp', 'unix'\]/) } end @@ -71,7 +71,7 @@ context "#{os} with bind_port => 4247" do - let(:params) { {:bind_port => '4247'} } + let(:params) { {:bind_port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::LivestatusListener::livestatus') .with({ 'target' => '/etc/icinga2/features-available/livestatus.conf' }) @@ -82,7 +82,7 @@ context "#{os} with bind_port => foo (not a valid integer)" do let(:params) { {:bind_port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -98,7 +98,7 @@ context "#{os} with socket_path => foo/bar (not an absolute path)" do let(:params) { {:socket_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -114,7 +114,7 @@ context "#{os} with compat_log_path => foo/bar (not an absolute path)" do let(:params) { {:compat_log_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end end @@ -188,7 +188,7 @@ context 'Windows 2012 R2 with socket_type => foo (not a valid value)' do let(:params) { {:socket_type => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported. Valid values are 'unix' and 'tcp'./) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['tcp', 'unix'\]/) } end @@ -202,7 +202,7 @@ context "Windows 2012 R2 with bind_port => 4247" do - let(:params) { {:bind_port => '4247'} } + let(:params) { {:bind_port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::LivestatusListener::livestatus') .with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/livestatus.conf' }) @@ -213,7 +213,7 @@ context "Windows 2012 R2 with bind_port => foo (not a valid integer)" do let(:params) { {:bind_port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end @@ -229,7 +229,7 @@ context 'Windows 2012 R2 with socket_path => foo/bar (not an absolute path)' do let(:params) { {:socket_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -245,6 +245,6 @@ context 'Windows 2012 R2 with compat_log_path => foo/bar (not an absolute path)' do let(:params) { {:compat_log_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end diff --git a/spec/classes/mainlog_spec.rb b/spec/classes/mainlog_spec.rb index d1d892d5b..f1358c72b 100644 --- a/spec/classes/mainlog_spec.rb +++ b/spec/classes/mainlog_spec.rb @@ -58,7 +58,7 @@ context "#{os} with severity => foo (not a valid value)" do let(:params) { {:severity => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['debug', 'information', 'notice', 'warning'\]/) } end @@ -74,7 +74,7 @@ context "#{os} with path => foo/bar (not an absolute path)" do let(:params) { {:path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end @@ -152,7 +152,7 @@ context 'Windows 2012 R2 with severity => foo (not a valid value)' do let(:params) { {:severity => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['debug', 'information', 'notice', 'warning'\]/) } end @@ -168,6 +168,6 @@ context 'Windows 2012 R2 with path => foo/bar (not an absolute path)' do let(:params) { {:path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end diff --git a/spec/classes/notification_spec.rb b/spec/classes/notification_spec.rb index 463029adc..bfc7f1cea 100644 --- a/spec/classes/notification_spec.rb +++ b/spec/classes/notification_spec.rb @@ -52,7 +52,7 @@ context "#{os} with enable_ha = foo (not a valid boolean)" do let(:params) { {:enable_ha => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end end end @@ -123,6 +123,6 @@ context "Windows 2012 R2 with enable_ha = foo (not a valid boolean)" do let(:params) { {:enable_ha => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end end diff --git a/spec/classes/opentsdb_spec.rb b/spec/classes/opentsdb_spec.rb index b83550e08..15aa8e9b2 100644 --- a/spec/classes/opentsdb_spec.rb +++ b/spec/classes/opentsdb_spec.rb @@ -52,7 +52,7 @@ context "#{os} with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::OpenTsdbWriter::opentsdb') .with({ 'target' => '/etc/icinga2/features-available/opentsdb.conf' }) @@ -63,7 +63,7 @@ context "#{os} with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end end end @@ -133,7 +133,7 @@ context "Windows 2012 R2 with port => 4247" do - let(:params) { {:port => '4247'} } + let(:params) { {:port => 4247} } it { is_expected.to contain_concat__fragment('icinga2::object::OpenTsdbWriter::opentsdb') .with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/opentsdb.conf' }) @@ -144,6 +144,6 @@ context "Windows 2012 R2 with port => foo (not a valid integer)" do let(:params) { {:port => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) } end end diff --git a/spec/classes/perfdata_spec.rb b/spec/classes/perfdata_spec.rb index 5d118c488..f89b92caf 100644 --- a/spec/classes/perfdata_spec.rb +++ b/spec/classes/perfdata_spec.rb @@ -57,7 +57,7 @@ context "#{os} with rotation_interval => foo (not a valid value)" do let(:params) { {:rotation_interval => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -73,7 +73,7 @@ context "#{os} with host_perfdata_path => foo/bar (not an absolute path)" do let(:params) { {:host_perfdata_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -89,7 +89,7 @@ context "#{os} with service_perfdata_path => foo/bar (not an absolute path)" do let(:params) { {:service_perfdata_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -105,7 +105,7 @@ context "#{os} with host_temp_path => foo/bar (not an absolute path)" do let(:params) { {:host_temp_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -121,7 +121,7 @@ context "#{os} with service_temp_path => foo/bar (not an absolute path)" do let(:params) { {:service_temp_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -215,7 +215,7 @@ context 'Windows 2012 R2 with rotation_interval => foo (not a valid value)' do let(:params) { {:rotation_interval => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -231,7 +231,7 @@ context 'Windows 2012 R2 with host_perfdata_path => foo/bar (not an absolute path)' do let(:params) { {:host_perfdata_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -247,7 +247,7 @@ context 'Windows 2012 R2 with service_perfdata_path => foo/bar (not an absolute path)' do let(:params) { {:service_perfdata_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -263,7 +263,7 @@ context 'Windows 2012 R2 with host_temp_path => foo/bar (not an absolute path)' do let(:params) { {:host_temp_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -279,7 +279,7 @@ context 'Windows 2012 R2 with service_temp_path => foo/bar (not an absolute path)' do let(:params) { {:service_temp_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 6fa31af48..0ddec843f 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -29,13 +29,13 @@ context "#{os} with ensure => foo (not a valid boolean)" do let(:params) { {:ensure => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported. Valid values are 'running' and 'stopped'./) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['running', 'stopped'\]/) } end context "#{os} with enable => foo (not a valid boolean)" do let(:params) { {:enable => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end context "#{os} with manage_service => true" do @@ -51,7 +51,7 @@ context "#{os} with manage_service => foo (not a valid boolean)" do let(:params) { {:manage_service => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end end end @@ -90,13 +90,13 @@ context "windows with ensure => foo (not a valid boolean)" do let(:params) { {:ensure => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported. Valid values are 'running' and 'stopped'./) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['running', 'stopped'\]/) } end context "windows with enable => foo (not a valid boolean)" do let(:params) { {:enable => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end context "windows with manage_service => true" do @@ -114,6 +114,6 @@ context "windows with manage_service => foo (not a valid boolean)" do let(:params) { {:manage_service => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end end diff --git a/spec/classes/statusdata_spec.rb b/spec/classes/statusdata_spec.rb index aaad1c096..ee1a11700 100644 --- a/spec/classes/statusdata_spec.rb +++ b/spec/classes/statusdata_spec.rb @@ -55,7 +55,7 @@ context "#{os} with update_interval => foo (not a valid value)" do let(:params) { {:update_interval => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -71,7 +71,7 @@ context "#{os} with status_path => foo/bar (not an absolute path)" do let(:params) { {:status_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -87,7 +87,7 @@ context "#{os} with objects_path => foo/bar (not an absolute path)" do let(:params) { {:objects_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end @@ -163,7 +163,7 @@ context 'Windows 2012 R2 with update_interval => foo (not a valid value)' do let(:params) { {:update_interval => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\[ms\]\*\$\/\]/) } end @@ -179,7 +179,7 @@ context 'Windows 2012 R2 with status_path => foo/bar (not an absolute path)' do let(:params) { {:status_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -195,6 +195,6 @@ context 'Windows 2012 R2 with objects_path => foo/bar (not an absolute path)' do let(:params) { {:objects_path => 'foo/bar'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end -end \ No newline at end of file +end diff --git a/spec/classes/syslog_spec.rb b/spec/classes/syslog_spec.rb index 468ebc38f..d35b35a50 100644 --- a/spec/classes/syslog_spec.rb +++ b/spec/classes/syslog_spec.rb @@ -53,7 +53,7 @@ context "#{os} with severity => foo (not a valid value)" do let(:params) { {:severity => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['debug', 'information', 'notice', 'warning'\]/) } end end @@ -125,6 +125,6 @@ context 'Windows 2012 R2 with severity => foo (not a valid value)' do let(:params) { {:severity => 'foo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['debug', 'information', 'notice', 'warning'\]/) } end -end \ No newline at end of file +end diff --git a/spec/defines/apiuser_spec.rb b/spec/defines/apiuser_spec.rb index b4a55e4f4..43b5023bc 100644 --- a/spec/defines/apiuser_spec.rb +++ b/spec/defines/apiuser_spec.rb @@ -30,7 +30,7 @@ context "#{os} with target => bar/baz (not valid absolute path)" do let(:params) { {:target => 'bar/baz', :permissions => ['*']} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -64,7 +64,7 @@ context "#{os} with permissions => foo (not a valid array)" do let(:params) { {:permissions => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end end end @@ -110,7 +110,7 @@ context "Windows 2012 R2 with target => C:bar/baz (not valid absolute path)" do let(:params) { {:target => 'C:bar/baz', :permissions => ['*']} } - it { is_expected.to raise_error(Puppet::Error, /"C:bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -144,6 +144,6 @@ context "Windows 2012 R2 with permissions => foo (not a valid array)" do let(:params) { {:permissions => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end -end \ No newline at end of file +end diff --git a/spec/defines/checkcommand_spec.rb b/spec/defines/checkcommand_spec.rb index 24994c741..5a372c3d5 100644 --- a/spec/defines/checkcommand_spec.rb +++ b/spec/defines/checkcommand_spec.rb @@ -44,12 +44,12 @@ context "#{os} with env => foo (not a valid hash)" do let(:params) { {:env => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end context "#{os} with timeout => 30" do - let(:params) { {:timeout => '30', :target => '/bar/baz', :command => ['foocommand']} } + let(:params) { {:timeout => 30, :target => '/bar/baz', :command => ['foocommand']} } it { is_expected.to contain_concat__fragment('icinga2::object::CheckCommand::bar') .with({'target' => '/bar/baz'}) @@ -60,7 +60,7 @@ context "#{os} with timeout => foo (not a valid integer)" do let(:params) { {:timeout => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -76,7 +76,7 @@ context "#{os} with arguments => foo (not a valid hash)" do let(:params) { {:arguments => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end end @@ -137,12 +137,12 @@ context "Windows 2012 R2 with env => foo (not a valid hash)" do let(:params) { {:env => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end context "Windows 2012 R2 with timeout => 30" do - let(:params) { {:timeout => '30', :target => 'C:/bar/baz', :command => ['foocommand']} } + let(:params) { {:timeout => 30, :target => 'C:/bar/baz', :command => ['foocommand']} } it { is_expected.to contain_concat__fragment('icinga2::object::CheckCommand::bar') .with({'target' => 'C:/bar/baz'}) @@ -153,7 +153,7 @@ context "Windows 2012 R2 with timeout => foo (not a valid integer)" do let(:params) { {:timeout => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -169,6 +169,6 @@ context "Windows 2012 R2 with arguments => foo (not a valid hash)" do let(:params) { {:arguments => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end diff --git a/spec/defines/checkresultreader_spec.rb b/spec/defines/checkresultreader_spec.rb index 06c53eba6..e124b212e 100644 --- a/spec/defines/checkresultreader_spec.rb +++ b/spec/defines/checkresultreader_spec.rb @@ -50,7 +50,7 @@ context "#{os} with spool_dir = foo/bar (not a valid absolute path)" do let(:params) { {:spool_dir => 'foo/bar', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end end @@ -119,6 +119,6 @@ context "Windows 2012 R2 with spool_dir = foo/bar (not a valid absolute path)" do let(:params) { {:spool_dir => 'foo/bar', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end end diff --git a/spec/defines/compatlogger_spec.rb b/spec/defines/compatlogger_spec.rb index 0afe74cd2..213843c45 100644 --- a/spec/defines/compatlogger_spec.rb +++ b/spec/defines/compatlogger_spec.rb @@ -51,7 +51,7 @@ context "#{os} with log_dir = foo/bar (not a valid absolute path)" do let(:params) { {:log_dir => 'foo/bar', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -66,7 +66,7 @@ context "#{os} with rotation_method = 'foo' (not a valid absolute path)" do let(:params) { {:rotation_method => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['DAILY', 'HOURLY', 'MONTHLY', 'WEEKLY'\]/) } end end end @@ -135,7 +135,7 @@ context "Windows 2012 R2 with log_dir = foo/bar (not a valid absolute path)" do let(:params) { {:log_dir => 'foo/bar', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -150,6 +150,6 @@ context "Windows 2012 R2 with rotation_method = 'foo' (not a valid absolute path)" do let(:params) { {:rotation_method => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['DAILY', 'HOURLY', 'MONTHLY', 'WEEKLY'\]/) } end end diff --git a/spec/defines/dependency_spec.rb b/spec/defines/dependency_spec.rb index 2ea3033bc..04ddba119 100644 --- a/spec/defines/dependency_spec.rb +++ b/spec/defines/dependency_spec.rb @@ -109,7 +109,7 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -133,7 +133,7 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -157,7 +157,7 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -194,7 +194,7 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end end @@ -321,7 +321,7 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -345,7 +345,7 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -369,7 +369,7 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -406,6 +406,6 @@ :parent_host_name => 'parentfoo', :child_host_name => 'childfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end diff --git a/spec/defines/endpoint_spec.rb b/spec/defines/endpoint_spec.rb index c6562507e..7551917d4 100644 --- a/spec/defines/endpoint_spec.rb +++ b/spec/defines/endpoint_spec.rb @@ -35,14 +35,14 @@ context "#{os} with ensure => foo (not a valid value)" do let(:params) { {:ensure => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['absent', 'present'\]/) } end context "#{os} with target => bar/baz (not valid absolute path)" do let(:params) { {:target => 'bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -55,7 +55,7 @@ context "#{os} with port => 4247" do - let(:params) { {:port => '4247', :target => '/bar/baz'} } + let(:params) { {:port => 4247, :target => '/bar/baz'} } it { is_expected.to contain_concat__fragment('icinga2::object::Endpoint::bar') .with_content(/port = 4247/) } @@ -65,7 +65,7 @@ context "#{os} with port => foo (not a valid integer)" do let(:params) { {:port => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -80,7 +80,7 @@ context "#{os} with log_duration => foo (not a valid value)" do let(:params) { {:log_duration => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end end end @@ -132,14 +132,14 @@ context "Windows 2012 R2 with ensure => foo (not a valid value)" do let(:params) { {:ensure => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['absent', 'present'\]/) } end context "Windows 2012 R2 with target => bar/baz (not valid absolute path)" do let(:params) { {:target => 'bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -152,7 +152,7 @@ context "Windows 2012 R2 with port => 4247" do - let(:params) { {:port => '4247', :target => 'C:/bar/baz'} } + let(:params) { {:port => 4247, :target => 'C:/bar/baz'} } it { is_expected.to contain_concat__fragment('icinga2::object::Endpoint::bar') .with_content(/port = 4247/) } @@ -162,7 +162,7 @@ context "Windows 2012 R2 with port => foo (not a valid integer)" do let(:params) { {:port => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -177,6 +177,6 @@ context "Windows 2012 R2 with log_duration => foo (not a valid value)" do let(:params) { {:log_duration => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end end diff --git a/spec/defines/eventcommand_spec.rb b/spec/defines/eventcommand_spec.rb index cc562921c..e15f36532 100644 --- a/spec/defines/eventcommand_spec.rb +++ b/spec/defines/eventcommand_spec.rb @@ -65,7 +65,7 @@ context "#{os} with env => 'foo' (not a valid hash)" do let(:params) { {:env => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -80,7 +80,7 @@ context "#{os} with timeout => 30" do - let(:params) { {:timeout => '30', :target => '/bar/baz', :command => ['foocommand']} } + let(:params) { {:timeout => 30, :target => '/bar/baz', :command => ['foocommand']} } it { is_expected.to contain_concat__fragment('icinga2::object::EventCommand::bar') .with({'target' => '/bar/baz'}) @@ -91,7 +91,7 @@ context "#{os} with timeout => foo (not a valid integer)" do let(:params) { {:timeout => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -110,7 +110,7 @@ context "#{os} with arguments => foo (not a valid hash)" do let(:params) { {:arguments => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end end @@ -195,7 +195,7 @@ context "Windows 2012 R2 with env => 'foo' (not a valid hash)" do let(:params) { {:env => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -210,7 +210,7 @@ context "Windows 2012 R2 with timeout => 30" do - let(:params) { {:timeout => '30', :target => 'C:/bar/baz', :command => ['foocommand']} } + let(:params) { {:timeout => 30, :target => 'C:/bar/baz', :command => ['foocommand']} } it { is_expected.to contain_concat__fragment('icinga2::object::EventCommand::bar') .with({'target' => 'C:/bar/baz'}) @@ -221,7 +221,7 @@ context "Windows 2012 R2 with timeout => foo (not a valid integer)" do let(:params) { {:timeout => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -239,7 +239,7 @@ context "Windows 2012 R2 with arguments => foo (not a valid hash)" do let(:params) { {:arguments => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end diff --git a/spec/defines/feature_spec.rb b/spec/defines/feature_spec.rb index 74996fd42..cef7c0ff9 100644 --- a/spec/defines/feature_spec.rb +++ b/spec/defines/feature_spec.rb @@ -15,6 +15,11 @@ ] end + before(:each) do + # Fake assert_private function from stdlib to not fail within this test + Puppet::Parser::Functions.newfunction(:assert_private, :type => :rvalue) { |args| + } + end on_supported_os.each do |os, facts| let :facts do @@ -28,7 +33,7 @@ it do expect { should contain_icinga2__feature('foo') - }.to raise_error(Puppet::Error, /foo isn't supported. Valid values are 'present' and 'absent'./) + }.to raise_error(Puppet::Error, /expects a match for Enum\['absent', 'present'\]/) end end @@ -88,6 +93,12 @@ ] end + before(:each) do + # Fake assert_private function from stdlib to not fail within this test + Puppet::Parser::Functions.newfunction(:assert_private, :type => :rvalue) { |args| + } + end + context 'Windows 2012 R2 with ensure => present, feature => foo' do let(:params) { {:ensure => 'present', 'feature' => 'foo'} } @@ -109,4 +120,4 @@ .that_notifies('Class[icinga2::service]') } end -end \ No newline at end of file +end diff --git a/spec/defines/host_spec.rb b/spec/defines/host_spec.rb index 77137fad3..aead2c906 100644 --- a/spec/defines/host_spec.rb +++ b/spec/defines/host_spec.rb @@ -27,7 +27,7 @@ context "#{os} with target => bar/baz (not valid absolute path)" do let(:params) { {:target => 'bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -43,7 +43,7 @@ context "#{os} with import => foo (not a valid array)" do let(:params) { {:import => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -86,7 +86,7 @@ context "#{os} with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -113,7 +113,7 @@ context "#{os} with max_check_attempts => 3" do - let(:params) { {:max_check_attempts => '3', :target => '/bar/baz', :check_command => 'foocommand'} } + let(:params) { {:max_check_attempts => 3, :target => '/bar/baz', :check_command => 'foocommand'} } it { is_expected.to contain_concat__fragment('icinga2::object::Host::bar') .with({'target' => '/bar/baz'}) @@ -124,7 +124,7 @@ context "#{os} with max_check_attempts => foo (not a valid integer)" do let(:params) { {:max_check_attempts => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -149,7 +149,7 @@ context "#{os} with check_timeout => foo (not a valid value)" do let(:params) { {:check_timeout => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -165,7 +165,7 @@ context "#{os} with check_interval => foo (not a valid value)" do let(:params) { {:check_interval => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -181,7 +181,7 @@ context "#{os} with retry_interval => foo (not a valid value)" do let(:params) { {:retry_interval => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -206,7 +206,7 @@ context "#{os} with enable_notifications => foo (not a valid boolean)" do let(:params) { {:enable_notifications => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -231,7 +231,7 @@ context "#{os} with enable_active_checks => foo (not a valid boolean)" do let(:params) { {:enable_active_checks => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -256,7 +256,7 @@ context "#{os} with enable_passive_checks => foo (not a valid boolean)" do let(:params) { {:enable_passive_checks => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -281,7 +281,7 @@ context "#{os} with enable_event_handler => foo (not a valid boolean)" do let(:params) { {:enable_event_handler => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -306,7 +306,7 @@ context "#{os} with enable_flapping => foo (not a valid boolean)" do let(:params) { {:enable_flapping => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -331,7 +331,7 @@ context "#{os} with enable_perfdata => foo (not a valid boolean)" do let(:params) { {:enable_perfdata => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -345,7 +345,7 @@ context "#{os} with flapping_threshold => 30" do - let(:params) { {:flapping_threshold => '30', :target => '/bar/baz', :check_command => 'foocommand'} } + let(:params) { {:flapping_threshold => 30, :target => '/bar/baz', :check_command => 'foocommand'} } it { is_expected.to contain_concat__fragment('icinga2::object::Host::bar') .with({'target' => '/bar/baz'}) @@ -356,7 +356,7 @@ context "#{os} with flapping_threshold => foo (not a valid integer)" do let(:params) { {:flapping_threshold => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -372,7 +372,7 @@ context "#{os} with volatile => foo (not a valid boolean)" do let(:params) { {:volatile => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -433,7 +433,7 @@ context "#{os} with icon_image => foo/foobar (not valid absolute path)" do let(:params) { {:icon_image => 'foo/foobar', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/foobar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -489,7 +489,7 @@ context "Windows 2012 R2 with target => bar/baz (not valid absolute path)" do let(:params) { {:target => 'bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -505,7 +505,7 @@ context "Windows 2012 R2 with import => foo (not a valid array)" do let(:params) { {:import => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -548,7 +548,7 @@ context "Windows 2012 R2 with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -575,7 +575,7 @@ context "Windows 2012 R2 with max_check_attempts => 3" do - let(:params) { {:max_check_attempts => '3', :target => '/bar/baz', :check_command => 'foocommand'} } + let(:params) { {:max_check_attempts => 3, :target => '/bar/baz', :check_command => 'foocommand'} } it { is_expected.to contain_concat__fragment('icinga2::object::Host::bar') .with({'target' => '/bar/baz'}) @@ -586,7 +586,7 @@ context "Windows 2012 R2 with max_check_attempts => foo (not a valid integer)" do let(:params) { {:max_check_attempts => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -611,7 +611,7 @@ context "Windows 2012 R2 with check_timeout => foo (not a valid value)" do let(:params) { {:check_timeout => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -627,7 +627,7 @@ context "Windows 2012 R2 with check_interval => foo (not a valid value)" do let(:params) { {:check_interval => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -643,7 +643,7 @@ context "Windows 2012 R2 with retry_interval => foo (not a valid value)" do let(:params) { {:retry_interval => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -668,7 +668,7 @@ context "Windows 2012 R2 with enable_notifications => foo (not a valid boolean)" do let(:params) { {:enable_notifications => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -693,7 +693,7 @@ context "Windows 2012 R2 with enable_active_checks => foo (not a valid boolean)" do let(:params) { {:enable_active_checks => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -718,7 +718,7 @@ context "Windows 2012 R2 with enable_passive_checks => foo (not a valid boolean)" do let(:params) { {:enable_passive_checks => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -743,7 +743,7 @@ context "Windows 2012 R2 with enable_event_handler => foo (not a valid boolean)" do let(:params) { {:enable_event_handler => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -768,7 +768,7 @@ context "Windows 2012 R2 with enable_flapping => foo (not a valid boolean)" do let(:params) { {:enable_flapping => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -793,7 +793,7 @@ context "Windows 2012 R2 with enable_perfdata => foo (not a valid boolean)" do let(:params) { {:enable_perfdata => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -807,7 +807,7 @@ context "Windows 2012 R2 with flapping_threshold => 30" do - let(:params) { {:flapping_threshold => '30', :target => '/bar/baz', :check_command => 'foocommand'} } + let(:params) { {:flapping_threshold => 30, :target => '/bar/baz', :check_command => 'foocommand'} } it { is_expected.to contain_concat__fragment('icinga2::object::Host::bar') .with({'target' => '/bar/baz'}) @@ -818,7 +818,7 @@ context "Windows 2012 R2 with flapping_threshold => foo (not a valid integer)" do let(:params) { {:flapping_threshold => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -834,7 +834,7 @@ context "Windows 2012 R2 with volatile => foo (not a valid boolean)" do let(:params) { {:volatile => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -895,7 +895,7 @@ context "Windows 2012 R2 with icon_image => foo/foobar (not valid absolute path)" do let(:params) { {:icon_image => 'foo/foobar', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/foobar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end diff --git a/spec/defines/hostgroup_spec.rb b/spec/defines/hostgroup_spec.rb index 95d9c6cc5..026ebd5f7 100644 --- a/spec/defines/hostgroup_spec.rb +++ b/spec/defines/hostgroup_spec.rb @@ -49,7 +49,7 @@ context "#{os} with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -121,7 +121,7 @@ context "Windows 2012 R2 with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end diff --git a/spec/defines/notification_spec.rb b/spec/defines/notification_spec.rb index 39c9613d6..15298b13c 100644 --- a/spec/defines/notification_spec.rb +++ b/spec/defines/notification_spec.rb @@ -110,7 +110,7 @@ context "#{os} with times => 'foo' (not a valid hash)" do let(:params) { {:times => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -144,7 +144,7 @@ context "#{os} with interval => foo (not a valid integer)" do let(:params) { {:interval => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -315,7 +315,7 @@ context "Windows 2012 R2 with times => 'foo' (not a valid hash)" do let(:params) { {:times => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -349,7 +349,7 @@ context "Windows 2012 R2 with interval => foo (not a valid integer)" do let(:params) { {:interval => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end diff --git a/spec/defines/notificationcommand_spec.rb b/spec/defines/notificationcommand_spec.rb index 7733383a3..3d98f4a63 100644 --- a/spec/defines/notificationcommand_spec.rb +++ b/spec/defines/notificationcommand_spec.rb @@ -65,7 +65,7 @@ context "#{os} with env => 'foo' (not a valid hash)" do let(:params) { {:env => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -80,7 +80,7 @@ context "#{os} with timeout => 30" do - let(:params) { {:timeout => '30', :target => '/bar/baz', :command => ['foocommand']} } + let(:params) { {:timeout => 30, :target => '/bar/baz', :command => ['foocommand']} } it { is_expected.to contain_concat__fragment('icinga2::object::NotificationCommand::bar') .with({'target' => '/bar/baz'}) @@ -91,7 +91,7 @@ context "#{os} with timeout => foo (not a valid integer)" do let(:params) { {:timeout => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -110,7 +110,7 @@ context "#{os} with arguments => foo (not a valid hash)" do let(:params) { {:arguments => 'foo', :target => '/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end end @@ -194,7 +194,7 @@ context "Windows 2012 R2 with env => 'foo' (not a valid hash)" do let(:params) { {:env => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -209,7 +209,7 @@ context "Windows 2012 R2 with timeout => 30" do - let(:params) { {:timeout => '30', :target => 'C:/bar/baz', :command => ['foocommand']} } + let(:params) { {:timeout => 30, :target => 'C:/bar/baz', :command => ['foocommand']} } it { is_expected.to contain_concat__fragment('icinga2::object::NotificationCommand::bar') .with({'target' => 'C:/bar/baz'}) @@ -220,7 +220,7 @@ context "Windows 2012 R2 with timeout => foo (not a valid integer)" do let(:params) { {:timeout => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -239,6 +239,6 @@ context "Windows 2012 R2 with arguments => foo (not a valid hash)" do let(:params) { {:arguments => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end diff --git a/spec/defines/object_spec.rb b/spec/defines/object_spec.rb index 71dab5182..7e64f5a9e 100644 --- a/spec/defines/object_spec.rb +++ b/spec/defines/object_spec.rb @@ -6,6 +6,12 @@ "class { 'icinga2': }" ] } + before(:each) do + # Fake assert_private function from stdlib to not fail within this test + Puppet::Parser::Functions.newfunction(:assert_private, :type => :rvalue) { |args| + } + end + on_supported_os.each do |os, facts| let :facts do facts @@ -37,14 +43,14 @@ context "#{os} with ensure => foo (not a valid value)" do let(:params) { {:ensure => 'foo', :object_type => 'foo', :target => '/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['absent', 'present'\]/) } end context "#{os} with target => bar/baz (not valid absolute path)" do let(:params) { {:object_type => 'foo', :target => 'bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -67,7 +73,7 @@ context "#{os} with template => foo (not a valid boolean)" do let(:params) { {:template => 'foo', :object_type => 'foo', :target => '/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -103,14 +109,14 @@ context "#{os} with apply => foo (not valid expression or boolean)" do let(:params) { {:apply => 'foo', :apply_target => 'Host', :object_type => 'foo', :target => '/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Boolean or Pattern\[\/\^\.\+\\s\+\(=>\\s\+\.\+\\s\+\)\?in\\s\+\.\+\$\/\]/) } end context "#{os} with apply_target => 'foo' (not a valid value)" do let(:params) { {:apply_target => 'foo', :object_type => 'foo', :target => '/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['Host', 'Service'\]/) } end @@ -146,7 +152,7 @@ context "#{os} with import => foo (not a valid array)" do let(:params) { {:import => 'foo', :object_type => 'foo', :target => '/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -162,7 +168,7 @@ context "#{os} with assign => foo (not a valid array)" do let(:params) { {:assign => 'foo', :object_type => 'foo', :target => '/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -177,7 +183,7 @@ context "#{os} with ignore => foo (not a valid array)" do let(:params) { {:ignore => 'foo', :object_type => 'foo', :target => '/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -287,6 +293,12 @@ "class { 'icinga2': }" ] } + before(:each) do + # Fake assert_private function from stdlib to not fail within this test + Puppet::Parser::Functions.newfunction(:assert_private, :type => :rvalue) { |args| + } + end + context "Windows 2012 R2 with all defaults and object_type => foo, target => C:/bar/baz, order => 10" do let(:params) { {:object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } @@ -312,14 +324,14 @@ context "Windows 2012 R2 with ensure => foo (not a valid value)" do let(:params) { {:ensure => 'foo', :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['absent', 'present'\]/) } end context "Windows 2012 R2 with target => bar/baz (not valid absolute path)" do let(:params) { {:object_type => 'foo', :target => 'bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -342,7 +354,7 @@ context "Windows 2012 R2 with template => foo (not a valid boolean)" do let(:params) { {:template => 'foo', :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) } end @@ -378,14 +390,14 @@ context "Windows 2012 R2 with apply => foo (not valid expression or boolean)" do let(:params) { {:apply => 'foo', :apply_target => 'Host', :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Boolean or Pattern\[\/\^\.\+\\s\+\(=>\\s\+\.\+\\s\+\)\?in\\s\+\.\+\$\/\]/) } end context "Windows 2012 R2 with apply_target => 'foo' (not a valid value)" do let(:params) { {:apply_target => 'foo', :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['Host', 'Service'\]/) } end @@ -420,7 +432,7 @@ context "Windows 2012 R2 with import => foo (not a valid array)" do let(:params) { {:import => 'foo', :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -436,7 +448,7 @@ context "Windows 2012 R2 with assign => foo (not a valid array)" do let(:params) { {:assign => 'foo', :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -451,7 +463,7 @@ context "Windows 2012 R2 with ignore => foo (not a valid array)" do let(:params) { {:ignore => 'foo', :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end diff --git a/spec/defines/scheduleddowntime_spec.rb b/spec/defines/scheduleddowntime_spec.rb index ab2b422d2..23523dfa5 100644 --- a/spec/defines/scheduleddowntime_spec.rb +++ b/spec/defines/scheduleddowntime_spec.rb @@ -96,7 +96,7 @@ :comment => 'foocomment', :ranges => { 'foo' => "bar", 'bar' => "foo"}} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -133,7 +133,7 @@ :comment => 'foocomment', :ranges => { 'foo' => "bar", 'bar' => "foo"}} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\(\\\.\\d\+\)\?\[dhms\]\?\$\/\]/) } end @@ -155,7 +155,7 @@ :author => 'fooauthor', :comment => 'foocomment'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end end @@ -270,7 +270,7 @@ :comment => 'foocomment', :ranges => { 'foo' => "bar", 'bar' => "foo"}} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -307,7 +307,7 @@ :comment => 'foocomment', :ranges => { 'foo' => "bar", 'bar' => "foo"}} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\(\\\.\\d\+\)\?\[dhms\]\?\$\/\]/) } end @@ -329,6 +329,6 @@ :author => 'fooauthor', :comment => 'foocomment'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end end diff --git a/spec/defines/service_spec.rb b/spec/defines/service_spec.rb index 31e43e5b2..0256da62c 100644 --- a/spec/defines/service_spec.rb +++ b/spec/defines/service_spec.rb @@ -77,7 +77,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end context "#{os} with vars => { foo => 'bar', bar => 'foo' }" do @@ -103,7 +103,7 @@ context "#{os} with max_check_attempts => 30" do - let(:params) { {:max_check_attempts => '30', :target => '/bar/baz', + let(:params) { {:max_check_attempts => 30, :target => '/bar/baz', :host_name => 'hostfoo', :check_command => 'commandfoo'} } @@ -118,7 +118,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -145,7 +145,7 @@ context "#{os} with check_interval => foo (not a valid value)" do let(:params) { {:check_interval => 'foo', :target => '/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -165,7 +165,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -185,7 +185,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -205,7 +205,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -225,7 +225,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -245,7 +245,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -265,7 +265,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -285,7 +285,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -301,7 +301,7 @@ context "#{os} with flapping_threshold => 30" do - let(:params) { {:flapping_threshold => '30', :target => '/bar/baz', + let(:params) { {:flapping_threshold => 30, :target => '/bar/baz', :host_name => 'hostfoo', :check_command => 'commandfoo'} } @@ -316,7 +316,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -336,7 +336,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -411,7 +411,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -516,7 +516,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end context "Windows 2012 R2 with vars => { foo => 'bar', bar => 'foo' }" do @@ -542,7 +542,7 @@ context "Windows 2012 R2 with max_check_attempts => 30" do - let(:params) { {:max_check_attempts => '30', :target => 'C:/bar/baz', + let(:params) { {:max_check_attempts => 30, :target => 'C:/bar/baz', :host_name => 'hostfoo', :check_command => 'commandfoo'} } @@ -557,7 +557,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -583,7 +583,7 @@ context "Windows 2012 R2 with check_interval => foo (not a valid value)" do let(:params) { {:check_interval => 'foo', :target => 'C:/bar/baz', :check_command => 'foocommand'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -603,7 +603,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Pattern\[\/\^\\d\+\\\.\?\\d\*\[d\|h\|m\|s\]\?\$\/\]/) } end @@ -623,7 +623,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -643,7 +643,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -663,7 +663,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -683,7 +683,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -703,7 +703,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -723,7 +723,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -739,7 +739,7 @@ context "Windows 2012 R2 with flapping_threshold => 30" do - let(:params) { {:flapping_threshold => '30', :target => 'C:/bar/baz', + let(:params) { {:flapping_threshold => 30, :target => 'C:/bar/baz', :host_name => 'hostfoo', :check_command => 'commandfoo'} } @@ -754,7 +754,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Integer/) } end @@ -774,7 +774,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -848,7 +848,7 @@ :host_name => 'hostfoo', :check_command => 'commandfoo'} } - it { is_expected.to raise_error(Puppet::Error, /"foo\/bar" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end diff --git a/spec/defines/servicegroup_spec.rb b/spec/defines/servicegroup_spec.rb index 63d75da77..bfa71df8c 100644 --- a/spec/defines/servicegroup_spec.rb +++ b/spec/defines/servicegroup_spec.rb @@ -57,7 +57,7 @@ context "#{os} with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end end @@ -132,6 +132,6 @@ context "Windows 2012 R2 with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end diff --git a/spec/defines/timeperiod_spec.rb b/spec/defines/timeperiod_spec.rb index 7a59327ee..a4337302c 100644 --- a/spec/defines/timeperiod_spec.rb +++ b/spec/defines/timeperiod_spec.rb @@ -57,7 +57,7 @@ context "#{os} with ranges => 'foo' (not a valid hash)" do let(:params) { {:ranges => 'foo', :target => '/bar/baz' } } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -73,7 +73,7 @@ context "#{os} with prefer_includes => foo (not a valid boolean)" do let(:params) { {:prefer_includes => 'foo', :target => '/bar/baz', :ranges => { 'foo' => "bar", 'bar' => "foo"}} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -89,7 +89,7 @@ context "#{os} with excludes => foo (not a valid array)" do let(:params) { {:excludes => 'foo', :target => '/bar/baz', :ranges => { 'foo' => "bar", 'bar' => "foo"} }} - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -105,7 +105,7 @@ context "#{os} with includes => foo (not a valid array)" do let(:params) { {:includes => 'foo', :target => '/bar/baz', :ranges => { 'foo' => "bar", 'bar' => "foo"} }} - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end end @@ -179,7 +179,7 @@ context "Windows 2012 R2 with ranges => 'foo' (not a valid hash)" do let(:params) { {:ranges => 'foo', :target => 'C:/bar/baz' } } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Hash/) } end @@ -195,7 +195,7 @@ context "Windows 2012 R2 with prefer_includes => foo (not a valid boolean)" do let(:params) { {:prefer_includes => 'foo', :target => 'C:/bar/baz', :ranges => { 'foo' => "bar", 'bar' => "foo"}} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -211,7 +211,7 @@ context "Windows 2012 R2 with excludes => foo (not a valid array)" do let(:params) { {:excludes => 'foo', :target => 'C:/bar/baz', :ranges => { 'foo' => "bar", 'bar' => "foo"} }} - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -227,7 +227,7 @@ context "Windows 2012 R2 with includes => foo (not a valid array)" do let(:params) { {:includes => 'foo', :target => 'C:/bar/baz', :ranges => { 'foo' => "bar", 'bar' => "foo"} }} - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end diff --git a/spec/defines/user_spec.rb b/spec/defines/user_spec.rb index 3bc10f69f..a69b0c02f 100644 --- a/spec/defines/user_spec.rb +++ b/spec/defines/user_spec.rb @@ -85,7 +85,7 @@ context "#{os} with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -101,7 +101,7 @@ context "#{os} with enable_notifications => foo (not a valid boolean)" do let(:params) { {:enable_notifications => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -126,7 +126,7 @@ context "#{os} with types => foo (not a valid array)" do let(:params) { {:types => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -142,7 +142,7 @@ context "#{os} with states => foo (not a valid array)" do let(:params) { {:states => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end end @@ -244,7 +244,7 @@ context "Windows 2012 R2 with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -260,7 +260,7 @@ context "Windows 2012 R2 with enable_notifications => foo (not a valid boolean)" do let(:params) { {:enable_notifications => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end @@ -285,7 +285,7 @@ context "Windows 2012 R2 with types => foo (not a valid array)" do let(:params) { {:types => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -301,7 +301,7 @@ context "Windows 2012 R2 with states => foo (not a valid array)" do let(:params) { {:states => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end end diff --git a/spec/defines/usergroup_spec.rb b/spec/defines/usergroup_spec.rb index d4d34caea..6e8474e2e 100644 --- a/spec/defines/usergroup_spec.rb +++ b/spec/defines/usergroup_spec.rb @@ -57,7 +57,7 @@ context "#{os} with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end @@ -138,7 +138,7 @@ context "Windows 2012 R2 with groups => foo (not a valid array)" do let(:params) { {:groups => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects an Array value/) } end diff --git a/spec/defines/zone_spec.rb b/spec/defines/zone_spec.rb index 2f9b1decf..b099fc14d 100644 --- a/spec/defines/zone_spec.rb +++ b/spec/defines/zone_spec.rb @@ -35,14 +35,14 @@ context "#{os} with ensure => foo (not a valid value)" do let(:params) { {:ensure => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['absent', 'present'\]/) } end context "#{os} with target => bar/baz (not valid absolute path)" do let(:params) { {:target => 'bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -57,7 +57,7 @@ context "#{os} with endpoints => foo (not a valid array)" do let(:params) { {:endpoints => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -80,7 +80,7 @@ context "#{os} with global => foo (not a valid boolean)" do let(:params) { {:global => 'foo', :target => '/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end end end @@ -131,14 +131,14 @@ context "Windows 2012 R2 with ensure => foo (not a valid value)" do let(:params) { {:ensure => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /foo isn't supported/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['absent', 'present'\]/) } end context "Windows 2012 R2 with target => bar/baz (not valid absolute path)" do let(:params) { {:target => 'bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"bar\/baz" is not an absolute path/) } + it { is_expected.to raise_error(Puppet::Error, /expects a match for Variant\[Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]/) } end @@ -153,7 +153,7 @@ context "Windows 2012 R2 with endpoints => foo (not a valid array)" do let(:params) { {:endpoints => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not an Array/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Array/) } end @@ -176,6 +176,6 @@ context "ws 2012 R2 with global => foo (not a valid boolean)" do let(:params) { {:global => 'foo', :target => 'C:/bar/baz'} } - it { is_expected.to raise_error(Puppet::Error, /"foo" is not a boolean/) } + it { is_expected.to raise_error(Puppet::Error, /expects a value of type Undef or Boolean/) } end -end \ No newline at end of file +end From e7542ca924ee4962c58fc623c15bdc8bc9c85c27 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Tue, 15 Aug 2017 13:57:28 +0200 Subject: [PATCH 11/11] Downsizing of parallel travis test Due to killed tests in Travis a lot of builds fail. This commit lower the parallel tests to 4 PARALLEL_TEST_PROCESSORS --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f1d310c57..2998cf7d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,15 +18,15 @@ matrix: fast_finish: true include: - rvm: 2.4.0 - env: PUPPET_VERSION="~> 5.0" CHECK=test + env: PUPPET_VERSION="~> 5.0" CHECK=test PARALLEL_TEST_PROCESSORS=4 - rvm: 2.3.3 - env: PUPPET_VERSION="~> 4.0" CHECK=test + env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=4 - rvm: 2.2.6 - env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.1.10 - env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes + env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=4 - rvm: 2.1.10 env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=4 + - rvm: 2.1.10 + env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes allow_failures: - rvm: 2.4.0 branches: