diff --git a/CHANGELOG.md b/CHANGELOG.md index 07b2ce4..5b6b14f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,241 +1,239 @@ # Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Changed - Replaced params classes with module hieradata. - Replaced function based parameter validation with Puppet Types. -- Export and collect will now only be enabled if - `$settings::storeconfigs` is `true` on the Puppet master. - Require `puppetlabs/stdlib` version `4.25.0` to support the types used. - Allow `puppetlabs/stdlib` `< 7.0.0`. - Allow Puppet version `< 7.0.0`. - Changed parameter `munin::plugin::config` default value from `undef` to `[]`. - Converted some templates from `erb` to `epp`. ### Added - New parameter `munin::master::node_definition::fqn`. This is the namevar for the defined type, and will default to the value of the title. - Added support for osfamily RedHat version 8 - Added Puppet Strings documentation ### Deprecated - Module is no longer supported on osfamily RedHat version 5 - Module is no longer supported on osfamily RedHat version 6 - Module is no longer supported on Ubuntu 14.04 ## [0.2.0] - 2019-03-03 ### Added - Support for DragonFly BSD ([#46](https://github.com/ssm/ssm-munin/issues/46)) - Support for FreeBSD as master ([#46](https://github.com/ssm/ssm-munin/issues/46)) - Export additional nodes with `munin::node::export::node_definitions` if `munin::node::export_node` is enabled. ([#44](https://github.com/ssm/ssm-munin/issues/44)) - New parameter `munin::master::package_name` - New parameter `munin::master::file_group` - New parameter `munin::master::config_root` ### Changed - Support puppet 4 and newer. ([#49](https://github.com/ssm/ssm-munin/issues/49)) - Scaffolding updated with PDK 1.9.0 ### Fixed - Support for Arch Linux ([#53](https://github.com/ssm/ssm-munin/issues/53)) - Fixed bug with parameter `munin::master::node_definitions` ### Deprecated - Module is no longer tested with Puppet 3.x and 2.x - Module is no longer tested on Ruby < 2.1.9 ## [0.1.0] - 2015-12-12 * Added support for Archlinux ([#40](https://github.com/ssm/ssm-munin/issues/40)) * Added acceptance tests * Added CONTRIBUTING.md for how to contribute to the module ([#41](https://github.com/ssm/ssm-munin/issues/41)) * Document all parameters in README.md ### munin::node * Two new parameters: **bind\_address** and **bind\_port** ([#37](https://github.com/ssm/ssm-munin/pull/37)) * Bugfix: Rescue InvalidAddressError only if ruby is capable ([#38](https://github.com/ssm/ssm-munin/pull/38)) ### contributors Contributors to this release: David Hayes, Julien Pivotto, Stig Sandbeck Mathisen, Victor Engmark ## [0.0.10] - 2015-08-01 * Bugfix: Add missing dependency for the "munin-node" package when $munin::node::purge_configs is true. ([#34](https://github.com/ssm/ssm-munin/pull/34)) Contributors to this release: Martin Meinhold ## [0.0.9] - 2015-07-29 * Bugfix: The mastergroup, if used in the node's FQN (Fully Qualified Name), should no longer be empty on Puppet 4.0. ([#27](https://github.com/ssm/ssm-munin/pull/27)) * Bugfix: Using munin::master and munin::node with export and collect disabled should no longer trigger warnings about missing storeconfigs. ([#30](https://github.com/ssm/ssm-munin/issues/30), [#33](https://github.com/ssm/ssm-munin/pull/33)) ### munin::master * Add FreeBSD support. ### munin::node * New feature: Log to syslog with the "log\_destination" and "syslog\_facility" parameters. ([#23](https://github.com/ssm/ssm-munin/issues/23), [#24](https://github.com/ssm/ssm-munin/pull/24), [#25](https://github.com/ssm/ssm-munin/pull/25)) * New feature: Set the plugin runtime timeout with the "timeout" parameter. ([#29](https://github.com/ssm/ssm-munin/issues/29), [#32](https://github.com/ssm/ssm-munin/pull/32)) * New feature: Purge unmanaged plugins and plugin configuration with the "purge_configs" parameter. ([#28](https://github.com/ssm/ssm-munin/issues/28), [#31](https://github.com/ssm/ssm-munin/pull/31)) ## [0.0.8] - 2015-02-06 Support the future parser. Contributors to this release: Rike-Benjamin Schuppner, Stig Sandbeck Mathisen ## [0.0.7] - 2014-12-05 This release adds support for DragonFly BSD, FreeBSD, OpenBSD. Other changes listed below, per component. Contributors to this release: Alex Hornung, Chris Roddy, Frank Groeneveld, Fredrik Thulin, Julien Pivotto, Martin Jackson, Sebastian Wiesinger, Stig Sandbeck Mathisen ### munin::node * Add "host_name" parameter to override the host name of the munin node. * Add "file_group" parameter, used for configuration and log files. * Add "log_dir" parameter. * Improved handling of "allow" ACL parameter. ### munin::master * Improved collection logic. Set "collect_nodes" to "mine" to collect nodes which are targeted for this master, or "unclaimed" to pick up nodes not aimed a specific master. * Add global tls_* parameters for connecting to nodes. * Add "dbdir", "htmldir", "rundir" parameters. * Add "extra_config" parameter, which takes an array of extra configuration lines for munin.conf. ### munin::plugin * Support absolute paths as target for a plugin. ## [0.0.6] - 2014-12-05 * Retracted, had a breaking bug on older (3.4.x) puppet versions. ## [0.0.5] - 2014-03-19 * Support multiple masters with different nodes (Thanks: Cristian Gae) * Support older (1.4.6) munin versions (Thanks: Sergio Oliveira) * Update for compatibility with puppet 3.4 (Thanks: Harald Skoglund) * Easier configuration with more parameters. All parameters have trivial validation. ### munin::master - new parameter "config_root". Defaults should match supported operating systems. ### munin::plugin - new parameter "config_root". Defaults should match supported operating systems. ### munin::node - new parameter "address". Default is $::fqdn. This will be used as the "address" when registering with the munin master. - new parameter "config_root". Defaults should match supported operating systems. - new parameter "package_name". Default should match supported operating systems. - new parameter "service_name". Default should match supported operating systems. - new parameter "service_ensure". Default is "". Possible values: "", "running" or "stopped". ### munin::params - new class ## [0.0.4] - 2013-08-13 Bugfix for the munin::plugin define. - Bugfix: Ensure that we can run tests on ruby 1.8. - Bugfix: No longer requires the class `Munin::Plugins`, which does not exist in this module. ([#3](https://github.com/ssm/ssm-munin/issues/3)) - The `ensure` attribute no longer defaults to "link". If not set, a potentially existing plugin with the same name is not touched. - Plugin and configuration directories are now configurable. - Improved rspec tests, which now actually match the documentation. ## [0.0.2] - 2013-06-31 A few pull requests - Bugfix: Install munin package before creating munin-conf.d directory ([#1](https://github.com/ssm/ssm-munin/pull/1)) - Make graph strategy configurable ([#2](https://github.com/ssm/ssm-munin/pull/2)) - Improve documentation ## [0.0.1] - 2013-06-02 Initial release diff --git a/manifests/master.pp b/manifests/master.pp index b228239..874750f 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -1,133 +1,133 @@ # @summary configure a munin master # # @see http://guide.munin-monitoring.org/en/latest/ # # @example Basic usage # include munin::master # # @example With TLS # class { 'munin::master': # tls => 'enabled', # tls_certificate => '/path/to/tls/certificate', # tls_private_key => '/path/to/tls/key', # } # # The munin master will install munin, and collect all exported munin # node definitions as files into /etc/munin/munin-conf.d/. # # Parameters: # # @param node_definitions [Hash] A hash of node definitions used by # create_resources to make static node definitions. # # @param host_name [String] A host name for this munin master, matched # with munin::node::mastername for collecting nodes. Defaults to # $::fqdn # # @param graph_strategy [Enum['cgi','cron']] 'cgi' (default) or 'cron' # Controls if munin-graph graphs all services ('cron') or if # graphing is done by munin-cgi-graph (which must configured # seperatly) # # @param html_strategy [Enum['cgi','cron']] 'cgi' (default) or 'cron' # Controls if munin-html will recreate all html pages every run interval # ('cron') or if html pages are generated by munin-cgi-graph (which must # configured seperatly) # # @param config_root [String] the root directory of the munin master # configuration. Default: /etc/munin on most platforms. # # @param file_group [String] The group name for configuration file # permissions. # # @param collect_nodes [Enum['enabled','disabled', # 'mine','unclaimed']] 'enabled' (default), 'disabled', 'mine' or # 'unclaimed'. 'enabled' makes the munin master collect all exported # node_definitions. 'disabled' disables it. 'mine' makes the munin # master collect nodes matching $munin::master::host_name, while # 'unclaimed' makes the munin master collect nodes not tagged with a # host name. # # @param dbdir [String] Path to the munin dbdir, where munin stores # everything. # # @param htmldir [String] Path to where munin will generate HTML # documents and graphs, used if graph_strategy is cron. # # @param rundir [String] Path to directory munin uses for pid and lock # files. # # @param logdir [String] Path to directory munin uses for log files. # # @param package_name [String] The package name used for installing # the munin master. # # @param tls [Enum['enabled','disabled']] 'enabled' or 'disabled' # (default). Controls the use of TLS globally for master to node # communications. # # @param tls_certificate [String] Path to a file containing a TLS # certificate. No default. Required if tls is enabled. # # @param tls_private_key [String] Path to a file containing a TLS # key. No default. Required if tls is enabled. # # @param tls_verify_certificate [Enum['yes','no']] 'yes' (default) or # 'no'. # # @param extra_config [Array] Extra lines of config to put in # munin.conf. class munin::master ( Hash $node_definitions, Enum['cgi', 'cron'] $graph_strategy, Enum['cgi', 'cron'] $html_strategy, Stdlib::Absolutepath $config_root, Enum['enabled', 'disabled', 'mine', 'unclaimed'] $collect_nodes, Optional[Stdlib::Absolutepath] $dbdir, Optional[Stdlib::Absolutepath] $htmldir, Optional[Stdlib::Absolutepath] $logdir, Optional[Stdlib::Absolutepath] $rundir, Enum['enabled', 'disabled'] $tls, Stdlib::Absolutepath $tls_certificate, Stdlib::Absolutepath $tls_private_key, Enum['yes','no'] $tls_verify_certificate, Stdlib::Host $host_name, String $file_group, Variant[String,Array[String]] $package_name, Array[String] $extra_config, ) { package { $package_name: ensure => installed, } File { owner => 'root', group => $file_group, mode => '0644', require => Package[$package_name], } file { "${config_root}/munin.conf": content => template('munin/munin.conf.erb'), } file { "${config_root}/munin-conf.d": ensure => directory, recurse => true, purge => true, force => true, } - if ($settings::storeconfigs == 'true' and $collect_nodes == 'enabled') { + if ($collect_nodes == 'enabled') { class { '::munin::master::collect': collect_nodes => $collect_nodes, host_name => $host_name, } } # Create static node definitions if $node_definitions { create_resources(munin::master::node_definition, $node_definitions, {}) } } diff --git a/manifests/node.pp b/manifests/node.pp index 54c5918..69997b8 100644 --- a/manifests/node.pp +++ b/manifests/node.pp @@ -1,189 +1,189 @@ # @summary configure a munin node # # Configure a munin node, and export configuration a munin master can # collect. # # @see http://guide.munin-monitoring.org/en/latest/ # # @example Basic usage # include munin::node # # @param allow [Array] List of IPv4 and IPv6 addresses and networks to # allow to connect. # # @param config_root [String] Root directory for munin configuration. # # @param nodeconfig [Array[String]] List of lines to append to the # munin node configuration. # # @param host_name [String] The host name munin node identifies # as. Defaults to the $::fqdn fact. # # @param log_dir [String] The log directory for the munin node # process. Defaults change according to osfamily, see # munin::params::node for details. # # @param log_file [String] File name for the log file, this is # appended to "log_dir". Defaults to "munin-node.log". # # @param log_destination [Enum['file','syslog']]: "file" or "syslog". # Defaults to "file". If log_destination is "syslog", the # "log_file" and "log_dir" parameters are ignored, and the # "syslog_*" parameters are used if set. # # @param purge_configs [Boolean] Removes all other munin plugins and # munin plugin configuration files. Boolean, defaults to false. # # @param syslog_facility [Optional[String]]: Defaults to undef, which # makes munin-node use the perl Net::Server module default of # "daemon". Possible values are any syslog facility by number, or # lowercase name. # # @param masterconfig [Array[String]] List of configuration lines to # append to the munin master node definitinon # # @param mastername [String] The name of the munin master server which # will collect the node definition. # # @param mastergroup [String] The group used on the master to # construct a FQN for this node. Defaults to "", which in turn makes # munin master use the domain. Note: changing this for a node also # means you need to move rrd files on the master, or graph history # will be lost. # # @param plugins [Hash] A hash used by create_resources to create # munin::plugin instances. # # @param address [String] The address used in the munin master node # definition. # # @param bind_address [String] The IP address the munin-node process # listens on. Defaults: *. # # @param bind_port [String] The port number the munin-node process # listens on. # # @param package_name [String] The name of the munin node package to # install. # # @param service_name [String] The name of the munin node service. # # @param service_ensure Used as parameter "ensure" for the munin node # service. # # @param export_node [Enum['enabled','disabled']]: "enabled" or # "disabled". Defaults to "enabled". Causes the node config to be # exported to puppetmaster. # # @param file_group [String] The UNIX group name owning the # configuration files, log files, etc. # # @param timeout [Optional[Integer]] Used to set the global plugin # runtime timeout for this node. Defaults to undef, which lets # munin-node use its default of 10 seconds. class munin::node ( String $address, Array $allow, Variant[Enum['*'],Stdlib::Host] $bind_address, Stdlib::Port $bind_port, Stdlib::Absolutepath $config_root, Stdlib::Host $host_name, Stdlib::Absolutepath $log_dir, String $log_file, Array $masterconfig, Optional[String] $mastergroup, Optional[Stdlib::Host] $mastername, Array $nodeconfig, String $package_name, Hash $plugins, Boolean $purge_configs, Enum['running','stopped'] $service_ensure, String $service_name, Enum['enabled','disabled'] $export_node, String $file_group, Enum['file','syslog'] $log_destination, Optional[ Variant[ Integer[0,23], Enum[ 'kern','user','mail','daemon','auth','syslog','lpr','news','uucp', 'authpriv','ftp','cron','local0','local1','local2','local3','local4', 'local5','local6','local7' ]]] $syslog_facility, Optional[Integer[0]] $timeout = $munin::params::node::timeout, # Integer? ) { case $log_destination { 'file': { $_log_file = "${log_dir}/${log_file}" validate_absolute_path($_log_file) } 'syslog': { $_log_file = 'Sys::Syslog' } default: { fail('log_destination is not set') } } if $mastergroup { $fqn = "${mastergroup};${host_name}" } else { $fqn = $host_name } if $service_ensure { $_service_ensure = $service_ensure } else { $_service_ensure = undef } # Defaults File { ensure => present, owner => 'root', group => $file_group, mode => '0444', } package { $package_name: ensure => installed, } service { $service_name: ensure => $_service_ensure, enable => true, require => Package[$package_name], } file { "${config_root}/munin-node.conf": content => template('munin/munin-node.conf.erb'), require => Package[$package_name], notify => Service[$service_name], } # Export a node definition to be collected by the munin master. # (Separated into its own class to prevent warnings about "missing # storeconfigs", even if $export_node is not enabled) - if ($settings::storeconfigs == 'true' and $export_node == 'enabled') { + if ($export_node == 'enabled') { class { '::munin::node::export': address => $address, fqn => $fqn, mastername => $mastername, masterconfig => $masterconfig, } } # Generate plugin resources from hiera or class parameter. create_resources(munin::plugin, $plugins, {}) # Purge unmanaged plugins and plugin configuration files. if $purge_configs { file { ["${config_root}/plugins", "${config_root}/plugin-conf.d" ]: ensure => directory, recurse => true, purge => true, require => Package[$package_name], notify => Service[$service_name], } } } diff --git a/spec/classes/munin_master_spec.rb b/spec/classes/munin_master_spec.rb index 4eb59c6..ffe86d1 100644 --- a/spec/classes/munin_master_spec.rb +++ b/spec/classes/munin_master_spec.rb @@ -1,155 +1,162 @@ require 'spec_helper' t_conf_dir = {} t_conf_dir.default = '/etc/munin' t_conf_dir['Solaris'] = '/opt/local/etc/munin' t_conf_dir['FreeBSD'] = '/usr/local/etc/munin' t_package = {} t_package.default = 'munin' t_package['FreeBSD'] = 'munin-master' describe 'munin::master' do on_supported_os.each do |os, facts| # Avoid testing on distributions similar to RedHat and Debian next if os =~ %r{^(ubuntu|centos|scientific|oraclelinux)-} context "on #{os}" do let(:facts) do facts end conf_dir = t_conf_dir[facts[:osfamily]] package = t_package[facts[:osfamily]] it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package(package) } context 'with default params' do + it { is_expected.to contain_class('munin::master::collect') } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{graph_strategy\s+cgi}) .with_content(%r{html_strategy\s+cgi}) end it do is_expected.to contain_file("#{conf_dir}/munin-conf.d") .with_ensure('directory') end end + context 'with collect_nodes => disabled' do + let(:params) { { collect_nodes: 'disabled' } } + + it { is_expected.not_to contain_class('munin::master::collect') } + end + context 'with html_strategy => cron' do let(:params) { { html_strategy: 'cron' } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{html_strategy\s+cron}) end end context 'with graph_strategy => cron' do let(:params) { { graph_strategy: 'cron' } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{graph_strategy\s+cron}) end end context 'with dbdir => /var/lib/munin' do let(:params) { { dbdir: '/var/lib/munin' } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{dbdir\s+/var/lib/munin}) end end context 'with htmldir => /var/www/munin' do let(:params) { { htmldir: '/var/www/munin' } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{htmldir\s+/var/www/munin}) end end context 'with logdir => /var/log/munin' do let(:params) { { dbdir: '/var/log/munin' } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{dbdir\s+/var/log/munin}) end end context 'with rundir => /var/run/munin' do let(:params) { { dbdir: '/var/run/munin' } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{dbdir\s+/var/run/munin}) end end context 'with tls => enabled' do let(:params) do { tls: 'enabled', tls_certificate: '/path/to/certificate.pem', tls_private_key: '/path/to/key.pem', tls_verify_certificate: 'yes', } end it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{tls = enabled}) .with_content(%r{tls_certificate = /path/to/certificate\.pem}) .with_content(%r{tls_private_key = /path/to/key\.pem}) .with_content(%r{tls_verify_certificate = yes}) end end context 'with node_definitions' do let(:params) do { node_definitions: { 'node-a' => { 'address' => 'munin://node-a.example.com', }, 'node-b' => { 'address' => 'munin://node-b.example.com', }, }, } end it { is_expected.to compile.with_all_deps } it { is_expected.to contain_munin__master__node_definition('node-a') } it { is_expected.to contain_munin__master__node_definition('node-b') } end context 'with extra_config' do token = '1b7febce-bb2d-4c18-b889-84c73538a900' let(:params) do { extra_config: [token] } end it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file("#{conf_dir}/munin.conf") .with_content(%r{#{token}}) end end end end end diff --git a/spec/classes/munin_node_spec.rb b/spec/classes/munin_node_spec.rb index 42e6a30..b5c3231 100644 --- a/spec/classes/munin_node_spec.rb +++ b/spec/classes/munin_node_spec.rb @@ -1,170 +1,177 @@ require 'spec_helper' t_conf_dir = {} t_conf_dir.default = '/etc/munin' t_conf_dir['DragonFly'] = '/usr/local/etc/munin' t_conf_dir['FreeBSD'] = '/usr/local/etc/munin' t_conf_dir['Solaris'] = '/opt/local/etc/munin' describe 'munin::node' do on_supported_os.each do |os, facts| # Avoid testing on distributions similar to RedHat and Debian next if os =~ %r{^(ubuntu|centos|scientific|oraclelinux)-} context "on #{os}" do let(:facts) { facts } it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('munin-node') } munin_confdir = t_conf_dir[facts[:osfamily]] munin_node_conf = "#{munin_confdir}/munin-node.conf" munin_plugin_dir = "#{munin_confdir}/plugins" munin_plugin_conf_dir = "#{munin_confdir}/plugin-conf.d" munin_node_service = case facts[:osfamily] when 'Solaris' then 'smf:/munin-node' else 'munin-node' end log_dir = case facts[:osfamily] when 'Solaris' then '/var/opt/log/munin' when 'RedHat' then '/var/log/munin-node' else '/var/log/munin' end it { is_expected.to contain_service(munin_node_service) } it { is_expected.to contain_file(munin_node_conf) } context 'with no parameters' do it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('munin::node::export') } it { is_expected.to contain_service(munin_node_service) } it do is_expected.to contain_file(munin_node_conf) .with_content(%r{host_name\s+\S+$}) .with_content(%r{log_file\s+#{log_dir}/munin-node.log}) end end + context 'with export_node => disabled' do + let(:params) { { export_node: 'disabled' } } + + it { is_expected.not_to contain_class('munin::node::export') } + end + context 'with parameter allow' do let(:params) do { allow: ['2001:db8:1::', '2001:db8:2::/64', '192.0.2.129', '192.0.2.0/25', '192\.0\.2'] } end it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file(munin_node_conf) .with_content(%r{^cidr_allow 192\.0\.2\.0/25$}) .with_content(%r{^cidr_allow 2001:db8:2::/64$}) .with_content(%r{^allow \^192\\\.0\\\.2\\\.129\$$}) .with_content(%r{^allow 192\\.0\\.2$}) .with_content(%r{^allow \^2001:db8:1::\$$}) end end context 'with parameter host_name' do let(:params) do { host_name: 'something.example.com' } end it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file(munin_node_conf) .with_content(%r{host_name\s+something.example.com}) end end context 'with parameter service_ensure' do let(:params) do { service_ensure: 'running' } end it { is_expected.to compile.with_all_deps } it do is_expected.to contain_service('munin-node') .with_ensure('running') end end context 'logging to syslog' do context 'defaults' do let(:params) do { log_destination: 'syslog' } end it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file(munin_node_conf) .with_content(%r{log_file\s+Sys::Syslog}) end end context 'with syslog options' do let(:params) do { log_destination: 'syslog', syslog_facility: 'local1' } end it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file(munin_node_conf) .with_content(%r{log_file\s+Sys::Syslog}) .with_content(%r{syslog_facility\s+local1}) end end end context 'purge_configs' do context 'set' do let(:params) { { purge_configs: true } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file(munin_plugin_dir) .with_ensure('directory') .with_recurse(true) .with_purge(true) end it do is_expected.to contain_file(munin_plugin_conf_dir) .with_ensure('directory') .with_recurse(true) .with_purge(true) end end context 'unset' do it { is_expected.to compile.with_all_deps } it { is_expected.not_to contain_file(munin_plugin_dir) } it { is_expected.not_to contain_file(munin_plugin_conf_dir) } end end context 'timeout' do context 'set' do let(:params) { { timeout: 123 } } it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file(munin_node_conf) .with_content(%r{^timeout 123}) end end context 'unset' do it { is_expected.to compile.with_all_deps } it do is_expected.to contain_file(munin_node_conf) .without_content(%r{^timeout}) end end end end end end