From 53ebd8f3b828ecfcb27defc5528c6acfc9f86e5f Mon Sep 17 00:00:00 2001 From: Judah Sotomayor Date: Thu, 15 Aug 2024 02:23:27 -0400 Subject: [PATCH] Fix bad group for config on FreeBSD check.pp did not use root_group setting. Make it use this setting to correctly set group. Update corresponding tests. --- manifests/check.pp | 2 +- spec/defines/check_spec.rb | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifests/check.pp b/manifests/check.pp index b416ac9..b443a91 100644 --- a/manifests/check.pp +++ b/manifests/check.pp @@ -29,7 +29,7 @@ file { "${monit::config_dir}/${name}": ensure => $ensure, owner => 'root', - group => 'root', + group => $monit::root_group, mode => '0644', source => $source, content => $content, diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index 0ad9895..d82ddbc 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -15,10 +15,13 @@ case facts[:os]['family'] when 'Debian' config_dir = '/etc/monit/conf.d' + root_group = 'root' when 'RedHat' config_dir = '/etc/monit.d' + root_group = 'root' when 'FreeBSD' config_dir = '/usr/local/etc/monit.d' + root_group = 'wheel' else raise 'unsupported osfamily detected' end @@ -30,7 +33,7 @@ it do is_expected.to contain_file("#{config_dir}/test").with('ensure' => 'present', 'owner' => 'root', - 'group' => 'root', + 'group' => root_group, 'mode' => '0644', 'source' => nil, 'content' => nil, @@ -50,7 +53,7 @@ it do is_expected.to contain_file("#{config_dir}/test").with('ensure' => value, 'owner' => 'root', - 'group' => 'root', + 'group' => root_group, 'mode' => '0644', 'source' => nil, 'content' => nil, @@ -77,7 +80,7 @@ it do is_expected.to contain_file("#{config_dir}/test").with('ensure' => 'present', 'owner' => 'root', - 'group' => 'root', + 'group' => root_group, 'mode' => '0644', 'source' => nil, 'content' => content, @@ -96,7 +99,7 @@ it do is_expected.to contain_file("#{config_dir}/test").with('ensure' => 'present', 'owner' => 'root', - 'group' => 'root', + 'group' => root_group, 'mode' => '0644', 'source' => 'puppet:///modules/monit/ntp', 'content' => nil,